[Fix]:purchase_requisition : requisition type exclusive then set the confirm purchase...
authorsbh (Open ERP) <sbh@tinyerp.com>
Fri, 9 Jul 2010 11:35:54 +0000 (17:05 +0530)
committersbh (Open ERP) <sbh@tinyerp.com>
Fri, 9 Jul 2010 11:35:54 +0000 (17:05 +0530)
bzr revid: sbh@tinyerp.com-20100709113554-htq4ole8xlezba0w

addons/purchase_requisition/purchase_requisition.py

index 7f7c10a..532c991 100644 (file)
@@ -129,10 +129,14 @@ class purchase_order(osv.osv):
     }
     def wkf_confirm_order(self, cr, uid, ids, context={}):
         res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context)
+        proc_obj=self.pool.get('procurement.order')
         for po in self.browse(cr, uid, ids, context):
             if po.requisition_id and (po.requisition_id.exclusive=='exclusive'):
                 for order in po.requisition_id.purchase_ids:
                     if order.id<>po.id:
+                        proc_ids = proc_obj.search(cr, uid, [('purchase_id', '=', order.id)])
+                        if proc_ids and po.state=='confirmed':
+                            proc_obj.wirte(cr,uid,proc_ids,{'purchase_id':po.id})
                         wf_service = netsvc.LocalService("workflow")
                         wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr)
                     self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'done','date_end':time.strftime('%Y-%m-%d %H:%M:%S')})