[FIX] purchase: _get_stock_move_price_unit
valuation_price_unit must in the uom of the line. Before the fix: - Set "Use anglo-saxon accounting" True at company settings. - Check that the "Account Properties" on product category are set (set a price difference account). - Set costing method = Average price, Inventory valuation = Perpetual (automated). - Create and confirm a PO (product purchased with unit of measure "Unit(s)" and purchase unit of measure "Dozen(s)") - Validate shipment (Receive the product) - Create and validate the supplier invoice - View the accounting journal entries Bug: In the invoice journal entry, there were: In the output account: debit=0.0 and credit=price unit of the PO line In the price difference account: debit= (11/12)*price unit of the PO line and credit=0.0 In the input account: debit=(1/12)*price unit of the PO line and credit=0.0 Expected behavior: In the output account: debit=0.0 and credit=price unit of the PO line In the input account: debit=price unit of the PO line and credit=0.0 opw:694108
This commit is contained in:
@@ -157,6 +157,7 @@ class AccountInvoice(models.Model):
|
||||
valuation_price_unit_total += val_stock_move.price_unit * val_stock_move.product_qty
|
||||
valuation_total_qty += val_stock_move.product_qty
|
||||
valuation_price_unit = valuation_price_unit_total / valuation_total_qty
|
||||
valuation_price_unit = self.env['product.uom']._compute_price(i_line.product_id.uom_id.id, valuation_price_unit, i_line.uom_id.id)
|
||||
if inv.currency_id.id != company_currency.id:
|
||||
valuation_price_unit = company_currency.with_context(date=inv.date_invoice).compute(valuation_price_unit, inv.currency_id, round=False)
|
||||
if float_compare(valuation_price_unit, i_line.price_unit, precision_digits=product_prec) != 0\
|
||||
|
||||
Reference in New Issue
Block a user