diff options
| author | Simon Lejeune <sle@openerp.com> | 2017-09-25 14:12:52 +0200 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2017-09-25 15:34:55 +0200 |
| commit | b27b86955ff16fb905f9c57a990bc77ae5c5245d (patch) | |
| tree | 6b58227c4e9d258c097e13447376def43281c8a0 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | ce4da0531dc18d68f0943e46a1ebe779761f8013 (diff) | |
[FIX] stock_account
This commit fixes:
- an expected singleton in vacuum, as `_get_in_domain` should be called
on the move we are looping on, not the whole recordset
- some entries were posted for non valuated stock moves
- the depends for the stock value where not correct and the value was
not recomputed when it should
- there was a mismatch between `get_price_unit` and `_get_price_unit`,
we rename all these method into the private one
- the valuation fields were copied on copied move. this proved to be
problmatic when creating extra move
- in the `_fifo_vacuum` method, when looking for candidates, filter on
available ones
We also refactore the way the valuation is implemented. Indeed, before
this commit, the valuation of a product was the sum of all the sum
fields of the valuated stock moves associated to the given product. This
proved to be the wrong approach when dealing with done stock move
edition and negative stock. Let's say you sold 20 items you do not have,
we'll post an entry with the estimated price and later, when we correct
this entry after receiving new products, updating the value was
complicated. We moved out from this approach by never editing the value
(it is the value at which the stock move was initially valuated) but
updating the remaining value: a negative stock move has a negative
remaining value, every time we compensate it we increase the value. Once
the remaining quantity is null, we wipe the remaining value. We adapted
the code according to this new principle, especially the code posting
the correction entry (that should compensate the negative remaiing
value).
A mechanism was not correctly implemented: increasing the quantity of a
done out move should re-run the fifo lookup. We extract the `_run_fifo`
method into a model method and add to it an optional quantity argument.
This allows to run the method from the write on a done stock move.
We also raise a blocking error if the valuation is 0, it means that the
user has not correctly set its master data.
We add a bunch of tests for all these usecases and complete some older
ones to check the total of account entries.
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
0 files changed, 0 insertions, 0 deletions
