[FIX] purchase: _anglo_saxon_purchase_move_lines
Let's consider a stockable product P with a product category PC with costing method = real price, valuation = perpetual, stock valuation account = SVA and price diff account = PDA. The cost defined for P in product.template is equal to 1$. Steps -Create a PO for P with a price unit = 5$ -Confirm PO and generate the invoice -Update the qty for P in the invoice and validate it(price unit is still 5$) Bug: In the general ledger: a move with a debit of 1$ is created for SVA and a debit of 4$ is created for PDA which is wrong. The expected result is: just a move of 5$ created for SVA and nothing for PDA because the difference between the purchase price and the invoiced price is 0. This commit fixes this problem. NB: in real price and average price, the considered cost must be the purchase price and not the cost defined in the product template. opw:740879
This commit is contained in:
@@ -144,6 +144,7 @@ class AccountInvoice(models.Model):
|
||||
valuation_price_unit = i_line.product_id.uom_id._compute_price(i_line.product_id.standard_price, i_line.uom_id)
|
||||
if i_line.product_id.cost_method != 'standard' and i_line.purchase_line_id:
|
||||
#for average/fifo/lifo costing method, fetch real cost price from incomming moves
|
||||
valuation_price_unit = i_line.purchase_line_id.product_uom._compute_price(i_line.purchase_line_id.price_unit, i_line.uom_id)
|
||||
stock_move_obj = self.env['stock.move']
|
||||
valuation_stock_move = stock_move_obj.search([('purchase_line_id', '=', i_line.purchase_line_id.id), ('state', '=', 'done')])
|
||||
if valuation_stock_move:
|
||||
|
||||
Reference in New Issue
Block a user