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

lp bug: https://launchpad.net/bugs/1236191 fixed

bzr revid: mat@openerp.com-20131007081014-8p0u7s0svx7gokg1
This commit is contained in:
Martin Trigaux 2013-10-07 10:10:14 +02:00
parent cdd5b4f130
commit 18528adaff
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: