purchase-workflow
purchase-workflow copied to clipboard
[16.0] purchase_landed_cost: Wrong value in "standard_price_old" field
Module
purchase_landed_cost
Describe the bug
The value of the "standard_price_old" field in the cost distribution varies depending on the "purchase_method" field of the product.
To Reproduce
Affected versions: 16
Steps to reproduce the behavior:
- Create a product with "purchase_method" field set to "purchase" option:
- Costing method set to "FIFO":
- Create a purchase order with this product and a 45% discount:
-
Confirm order, receive product and create bill.
-
Create a purchase cost distribution and import incoming shipment. Previous cost field ("standard_price_old") value is the discounted amount:
- Repeat all the previous steps, but set the product's "purchase_method" field to "receive":
- In this case, the value of the previous cost field in the cost distribution is:
Expected behavior I think the correct value should be 3194'40 (step 7) regardless of the "purchase_method" field setting.
Maybe the problem is that the function "_compute_standard_price_old" of "purchase.cost.distribution.line", is calling the function "_get_price_unit" of "stock.move". In the module "purchase_stock", this function has a condition that depends on the field "purchase_method".
As I said before, I think that when performing a cost distribution, the values should not depend on "purchase_method".
Is this correct or am I wrong?
Thanks in advance.