[MERGE] [FIX] purchase: block workflow when supplier check fails, even if already has set an error message

bzr revid: mat@openerp.com-20131007084230-313996890uu6rr27
This commit is contained in:
Martin Trigaux 2013-10-07 10:42:30 +02:00
commit ef933d2ea6
1 changed files with 6 additions and 5 deletions

View File

@ -1045,11 +1045,12 @@ class procurement_order(osv.osv):
elif not partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']:
message = _('No address defined for the supplier')
if message and procurement.message != message:
#temporary context passed in write to prevent an infinite loop
ctx_wkf = dict(context or {})
ctx_wkf['workflow.trg_write.%s' % self._name] = False
self.write(cr, uid, [procurement.id], {'message':message}, context=ctx_wkf)
if message:
if procurement.message != message:
#temporary context passed in write to prevent an infinite loop
ctx_wkf = dict(context or {})
ctx_wkf['workflow.trg_write.%s' % self._name] = False
self.write(cr, uid, [procurement.id], {'message':message}, context=ctx_wkf)
return False
if user.company_id and user.company_id.partner_id: