From dacab6945e717e1c0f60e2cddc587f8277f3a147 Mon Sep 17 00:00:00 2001 From: Sanjay Jamod Date: Fri, 16 Jun 2017 15:58:51 +0530 Subject: [PATCH] [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 --- addons/purchase/models/purchase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 4ce0b837396..83169ba7325 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -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