[IMP] purchase: update unit price on quantity change

When the quantity of a purchase line id is changed, the unit price is
set to 0.0 if the PO partner has a seller line on the product and the
quantity choosen on the line cannot get a seller.

TASK-34233
This commit is contained in:
Sanjay Jamod
2018-08-09 09:58:03 +02:00
committed by Pierre Masereel
parent 1ca06f2758
commit dacab6945e
+2
View File
@@ -599,6 +599,8 @@ class PurchaseOrderLine(models.Model):
self.date_planned = self._get_date_planned(seller).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
if not seller:
if self.product_id.seller_ids.filtered(lambda s: s.name.id == self.partner_id.id):
self.price_unit = 0.0
return
price_unit = self.env['account.tax']._fix_tax_included_price_company(seller.price, self.product_id.supplier_taxes_id, self.taxes_id, self.company_id) if seller else 0.0