diff options
| author | Simon Lejeune <sle@openerp.com> | 2019-05-11 11:50:41 +0000 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2019-06-09 14:11:36 +0000 |
| commit | 7a27d52d71bf2925284bb1a7bda8cc2a1918c30c (patch) | |
| tree | 2833ec7de3a7cfac5591ac0762b47f8e3ec6e63c /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 977169feeb68c2df6a2a5f8b247024949633efc0 (diff) | |
[REF] stock_account: refactor `_is_*` helpers
Before this commit, there were the `_is_in`, `_is_out`, `_is_dropshipped`
and `_is_dropshipped_returned` helpers on stock move. These methods were
called on the stock moves upon their validation to know if they should
be valued.
But the valuation of a stock move actually depends on its move lines[0].
These helpers weren't convenient enough since every cost method should
implement the logic to get the valud quantity (see _run_valuation and
_run_fifo).
We add helpers returning in and out move lines and `_is_in` and
`_is_out` to use these helpers to decide their return value.
We also expose a list of valued type (`_get_valued_types`) that will be
used in the move validation to check every `_is_*`helper without calling
them explicitely. Once we'll know the valued type of each move to
validate, we'll be able to call the methods actually doing something
with the valuation in batch. We prepare this in _action_done to lay the
foundation of the batch calls when the stock valuation layer will be
implemented.
We took the opportunity to fix an edge case of the consignment: if the
owner of a move is the company of the move, it should be valued.
[0] 48f4ce4afa1a213cf5e66d1f34f4f2ee4351b2e5
task-1875873
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
0 files changed, 0 insertions, 0 deletions
