[IMP] purchase: split onchange product_id for matrix triggering.

This commit is contained in:
Victor Feyens
2019-08-07 12:50:09 +00:00
parent 56aab8bc11
commit 3e41a1dbf2
+10 -4
View File
@@ -598,8 +598,17 @@ class PurchaseOrderLine(models.Model):
# Reset date, price and quantity since _onchange_quantity will provide default values
self.date_planned = datetime.today().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
self.price_unit = self.product_qty = 0.0
self.product_uom = self.product_id.uom_po_id or self.product_id.uom_id
self._product_id_change()
self._suggest_quantity()
self._onchange_quantity()
def _product_id_change(self):
if not self.product_id:
return
self.product_uom = self.product_id.uom_po_id or self.product_id.uom_id
product_lang = self.product_id.with_context(
lang=self.partner_id.lang,
partner_id=self.partner_id.id,
@@ -611,9 +620,6 @@ class PurchaseOrderLine(models.Model):
self._compute_tax_id()
self._suggest_quantity()
self._onchange_quantity()
@api.onchange('product_id')
def onchange_product_id_warning(self):
if not self.product_id: