Skip to content
Snippets Groups Projects
Commit fdef30fc authored by Christophe Simonis's avatar Christophe Simonis
Browse files

[FIX] purchase: ignore quantity sign when computing move amount_currency

Since 348c371e, the quantity is negative
for out moves. Ignore the sign when computing the amount_currency value.
parent ab6c3f66
No related branches found
No related tags found
No related merge requests found
......@@ -56,12 +56,11 @@ class StockMove(models.Model):
self.ensure_one()
rslt = super(StockMove, self)._generate_valuation_lines_data(partner_id, qty, debit_value, credit_value, debit_account_id, credit_account_id)
if self.purchase_line_id:
purchase_currency = self.purchase_line_id.currency_id
if purchase_currency != self.company_id.currency_id:
purchase_price_unit = self.purchase_line_id.price_unit
currency_move_valuation = purchase_currency.round(purchase_price_unit * qty)
currency_move_valuation = purchase_currency.round(purchase_price_unit * abs(qty))
rslt['credit_line_vals']['amount_currency'] = rslt['credit_line_vals']['credit'] and -currency_move_valuation or currency_move_valuation
rslt['credit_line_vals']['currency_id'] = purchase_currency.id
rslt['debit_line_vals']['amount_currency'] = rslt['debit_line_vals']['credit'] and -currency_move_valuation or currency_move_valuation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment