Skip to content

Commit

Permalink
[FIX] purchase: _anglo_saxon_purchase_move_lines
Browse files Browse the repository at this point in the history
Since the stock valuation refactoring, the price_unit on out move are
negatives. This brought an issue when _anglo_saxon_purchase_move_lines
tried to get the amount of the accounting entry in the stock received
account when validating a credit note for a return: as the price_unit
total resulted in 0, the entry was taken from the price difference
account.

Fixes odoo#20840
opw 781836
  • Loading branch information
sle-odoo committed Nov 20, 2017
1 parent 2d5ae3c commit 5e48193
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/purchase/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _anglo_saxon_purchase_move_lines(self, i_line, res):
valuation_price_unit_total = 0
valuation_total_qty = 0
for val_stock_move in valuation_stock_move:
valuation_price_unit_total += val_stock_move.price_unit * val_stock_move.product_qty
valuation_price_unit_total += abs(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 = i_line.product_id.uom_id._compute_price(valuation_price_unit, i_line.uom_id)
Expand Down

0 comments on commit 5e48193

Please sign in to comment.