purchase-workflow icon indicating copy to clipboard operation
purchase-workflow copied to clipboard

[16.0] purchase_landed_cost: Wrong value in "standard_price_old" field

Open greciosd opened this issue 6 months ago • 0 comments

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:

  1. Create a product with "purchase_method" field set to "purchase" option:

image

  1. Costing method set to "FIFO":

image

  1. Create a purchase order with this product and a 45% discount:

image

  1. Confirm order, receive product and create bill.

  2. Create a purchase cost distribution and import incoming shipment. Previous cost field ("standard_price_old") value is the discounted amount:

image

  1. Repeat all the previous steps, but set the product's "purchase_method" field to "receive":

image

  1. In this case, the value of the previous cost field in the cost distribution is:

image

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".

image

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.

greciosd avatar Aug 09 '24 14:08 greciosd