[FIX] purchase: no mrp fields in purchase please

Fields of mrp should not be put in purchase like this,
as it can throw a traceback e.g. if you generate a purchase
based on a picking in MTO.
This commit is contained in:
Josse Colpaert
2018-06-25 15:38:23 +02:00
parent 752347cdef
commit d4582cf020
+2 -2
View File
@@ -1062,7 +1062,7 @@ class ProcurementOrder(models.Model):
if not po:
vals = procurement._prepare_purchase_order(partner)
po = self.env['purchase.order'].create(vals)
name = (procurement.group_id and (procurement.group_id.name + ":") or "") + (procurement.name != "/" and procurement.name or procurement.move_dest_id.raw_material_production_id and procurement.move_dest_id.raw_material_production_id.name or "")
name = (procurement.group_id and (procurement.group_id.name + ":") or "") + (procurement.name != "/" and procurement.name or "")
message = _("This purchase order has been created from: <a href=# data-oe-model=procurement.order data-oe-id=%d>%s</a>") % (procurement.id, name)
po.message_post(body=message)
cache[domain] = po
@@ -1075,7 +1075,7 @@ class ProcurementOrder(models.Model):
po.write({'origin': po.origin})
else:
po.write({'origin': procurement.origin})
name = (self.group_id and (self.group_id.name + ":") or "") + (self.name != "/" and self.name or self.move_dest_id.raw_material_production_id and self.move_dest_id.raw_material_production_id.name or "")
name = (self.group_id and (self.group_id.name + ":") or "") + (self.name != "/" and self.name or "")
message = _("This purchase order has been modified from: <a href=# data-oe-model=procurement.order data-oe-id=%d>%s</a>") % (procurement.id, name)
po.message_post(body=message)
if po: