[IMP] contract_variable_quantity: Recompute price when changing qty

If you have contract lines with automatic price and your pricelist
contains different prices per quantity, the price is not changed
when computing quantity.

This PR fixes this.
This commit is contained in:
Pedro M. Baeza
2018-04-24 13:22:37 +02:00
committed by sbejaoui
parent 904ac526a4
commit c9c9ad5ba2
2 changed files with 6 additions and 2 deletions

View File

@@ -38,6 +38,10 @@ class AccountAnalyticAccount(models.Model):
vals = {}
else:
vals['quantity'] = qty
# Re-evaluate price with this new quantity
vals['price_unit'] = line.with_context(
contract_line_qty=qty,
).price_unit
return vals