[15.0][FIX] stock_valuation_fifo_lot: fix _get_price_unit() function and mrp dependence#2104
[15.0][FIX] stock_valuation_fifo_lot: fix _get_price_unit() function and mrp dependence#2104
Conversation
|
Hi @newtratip, |
e8eaa47 to
093087c
Compare
c278787 to
a576c1f
Compare
luis-ron
left a comment
There was a problem hiding this comment.
I have carried out various tests, which I list below:
Test characteristics:
Product categories have been configured using the FIFO valuation method.
Various products have been created and configured with the following characteristics:
-
Storable products.
-
With a product category using the FIFO valuation method.
-
Products with batch traceability.
-
The landed costs will be divided equally among all purchase units.
Test flow:
- Various purchases of these products have been made, covering various aspects:
- Purchase of PRODUCT A with 1 batch. Price per unit: €2
- Purchase of PRODUCT B with more than 1 batch (2 or more).
- Various purchases of PRODUCT C, with various batches.
In each of these purchases, landed costs have been added, thus creating a more detailed valuation and ensuring the correct behavior of the system. To simplify matters, a landed cost of €10 has been applied to each of the purchases.
The result of the purchase valuation is as follows:
-
Purchase 1: PRODUCT A | 10 units | €2 per unit | Landed cost €10 | Lot 1 -> Total cost: €3
-
Purchase 2: PRODUCT B | 10 units | €2 per unit | Landed cost €10 | Lot 1 | Lot 2 -> Total cost: €3
-
Purchase 3: Product C | 10 units | €2 per unit | Landed cost €10 | Lot 1 -> Total cost: €3
-
Purchase 4: Product C | 10 units | €3 per unit | Landed cost €10 | Lot 2 -> Total cost €4.
-
Purchase 5: Product C | 10 units | €4 per unit | Landed cost €10 | Lot 3 -> Total cost €5.
I then made a sale of each of the products purchased.
The cost shown on the sales order line is correct.
I then carried out return tests, validating the delivery note for this type of operation.
When validating the delivery note, the cost of the sales order line is correct, maintaining a relationship with the landed cost indicated in the original purchase.
This allows for a correct valuation of the inventory, even when returning products.
It has also been tested with purchases that have more than one landed cost asociated, maintaining correct traceability.
It has been tested with the sale of various products with various landed costs.
The result is correct.
| "stock_account", | ||
| "stock_no_negative", | ||
| "stock_landed_costs", | ||
| "mrp_landed_costs", |
There was a problem hiding this comment.
why mandatory install mrp?
There was a problem hiding this comment.
The mrp_production_ids field, used in this module, is created in the mrp_landed_costs module.
https://github.com/odoo/odoo/blob/15.0/addons/mrp_landed_costs/models/stock_landed_cost.py#L13
There was a problem hiding this comment.
Absolutely correct, but that comes from the "mrp_landed_costs" module. The dependency on MRP isn't necessary for this module. Several functionalities are being combined in this module that would have to be separated into another module or implemented with a soft dependency.
There was a problem hiding this comment.
Just FYI, we have split the module to stock_valuation_fifo_lot and stock_valuation_fifo_lot_mrp_landed_cost in the 16.0 migration PR.
- Do not override the return if the move is a return, odoo calculates it correctly (this module does not) - Calculate the resulting price unit with the related landed costs of the candidate SVL
a576c1f to
b21c5f4
Compare
… stock_valuation_fifo_lot_mrp_landed_cost
b21c5f4 to
badcc2c
Compare
3c424ad to
0ea4554
Compare
|
This PR has the |
|
Hello @newtratip This PR includes some fixes for the module you created. It’s ready to merge. Thanks! |
|
Hello @dreispt This PR includes a few fixes for the module you previously merged. Thanks! |
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
This PR fixes some errors of the module:
Unit tests have also been added to cover the case of returning a outgoing shipping
The README has also been improved
T-8760