[FIX] purchase, purchase_requisition: make_po
When a product is set up to generate a purchase tender instead of a purchase order, the associated procurement is set in exception. This is because the result of `make_po` is returned by the method `_run`, and the result of `_run` is used to determine if the procurement is running or in exception. Since a purchase tender does not generate the PO, the method `make_po` returns an empty list, and therefore the procurement is considered as in exception. The fix is to return the procurement_id instead if a purchase order or a purchase tender has been created. opw-672170
This commit is contained in:
@@ -904,7 +904,8 @@ class ProcurementOrder(models.Model):
|
||||
po.write({'origin': po.origin})
|
||||
else:
|
||||
po.write({'origin': procurement.origin})
|
||||
res += po.ids
|
||||
if po:
|
||||
res += [procurement.id]
|
||||
|
||||
# Create Line
|
||||
po_line = False
|
||||
|
||||
@@ -431,6 +431,7 @@ class procurement_order(osv.osv):
|
||||
self.message_post(cr, uid, [procurement.id], body=_("Purchase Requisition created"), context=context)
|
||||
procurement.write({'requisition_id': requisition_id})
|
||||
req_ids += [procurement.id]
|
||||
res += [procurement.id]
|
||||
set_others = set(ids) - set(req_ids)
|
||||
if set_others:
|
||||
res += super(procurement_order, self).make_po(cr, uid, list(set_others), context=context)
|
||||
|
||||
Reference in New Issue
Block a user