-
-
Notifications
You must be signed in to change notification settings - Fork 724
[15.0][FIX] stock_valuation_fifo_lot: fix _get_price_unit() function and mrp dependence #2104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 15.0
Are you sure you want to change the base?
[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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why mandatory install mrp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mrp_production_ids field, used in this module, is created in the mrp_landed_costs module.
lot_ids = self.mrp_production_ids.mapped("lot_producing_id") |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd Functional review: LGTM 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
This PR has the |
Hello @newtratip This PR includes some fixes for the module you created. It’s ready to merge. Thanks! |
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