diff options
| author | Simon Lejeune <sle@openerp.com> | 2018-02-22 17:46:30 +0100 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2018-04-16 11:26:49 +0200 |
| commit | 3a8281175d156814f3258b6aff434564088d1efd (patch) | |
| tree | c5379cf2dc2aa0a79123d0715048245c0d45daa5 /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 0eec54cae0041537da166f75b5d35388546cf6b9 (diff) | |
[REF] stock_account: support valuation at date
For the standard and average cost method, we use `qty_available` at date
and the `product.price.history` table.
For FIFO, the normal way would have been to get the `qty_available` at
date and value this quantity with the more recent IN moves at this date.
But there's two main obstacles preventing to use this solution:
- when editing a done move to change the quantity, the change is
reflected at the date, the `qty_available` at date will be incremented
- in the same usecase, the remaining_qty and remaining_value is
incremented in place, which mean that even if the layer was already
consumed, it's now appearing again at the bottom of the fifo layer
Fixing this issue by adding a stock move at the date of today instead of
editing in place in v11 and adding a proper "cost layer" model in master
was deemed too complex as well as unnecessary by our bosses
So we now say we continue to update in place, and when looking at the
quantity at date
- if periodic, we sum the value of the move since the beginning of times
- if perpetual, we sum the balance of the account move lines since the
beginning of times. Also, in this case, the quantity at date is
computed across account move lines too, via the "quantity" field on
aml.
This commit adds three non stored computed field:
- qty_at_date: will be computed across stock moves if fifo periodic and
across account move line if fifo perpetual to reflect the design
choice: if periodic, we *really* edit in the past ; if perpetual, no,
the change is done at today's date
- stock_fifo_real_time_aml_ids: the used aml to compute qty_at_date
- stock_fifo_manual_move_ids: the used move to compute qty_at_date
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
0 files changed, 0 insertions, 0 deletions
