From 9bd291f48f374b4c5b906e73dc1775c11c02f267 Mon Sep 17 00:00:00 2001 From: csn-openerp Date: Fri, 1 Feb 2013 15:57:02 +0100 Subject: [PATCH 1/2] [FIX]procurement : traceback in sql request when message was too large -> changed to write and removed limit size bzr revid: csn@openerp.com-20130201145702-m35h1spf9jx02swr --- addons/procurement/procurement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 50efe0f500e..a4e12d81617 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -103,7 +103,7 @@ class procurement_order(osv.osv): readonly=True, required=True, help="If you encode manually a Procurement, you probably want to use" \ " a make to order method."), 'note': fields.text('Note'), - 'message': fields.char('Latest error', size=124, help="Exception occurred while computing procurement orders."), + 'message': fields.char('Latest error', help="Exception occurred while computing procurement orders."), 'state': fields.selection([ ('draft','Draft'), ('cancel','Cancelled'), @@ -367,7 +367,7 @@ class procurement_order(osv.osv): if message: message = _("Procurement '%s' is in exception: ") % (procurement.name) + message - cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) + procurement.write({'message': message}) self.message_post(cr, uid, [procurement.id], body=message, context=context) return ok From cb0a76f312507abeacec0c303015074475ad0768 Mon Sep 17 00:00:00 2001 From: csn-openerp Date: Mon, 4 Feb 2013 17:31:51 +0100 Subject: [PATCH 2/2] [FIX]procurement : fix infinite loop in workflow transition due to a write bzr revid: csn@openerp.com-20130204163151-ryyabvw5zjsa0bwm --- addons/procurement/procurement.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index a4e12d81617..f31244fd8d0 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -367,10 +367,19 @@ class procurement_order(osv.osv): if message: message = _("Procurement '%s' is in exception: ") % (procurement.name) + message - procurement.write({'message': message}) + 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) self.message_post(cr, uid, [procurement.id], body=message, context=context) return ok + def _workflow_trigger(self, cr, uid, ids, trigger, context=None): + wkf_op_key = 'workflow.%s.%s' % (trigger, self._name) + if context and not context.get(wkf_op_key, True): + # make sure we don't have a trigger loop while processing triggers + return + return super(procurement_order,self)._workflow_trigger(cr, uid, ids, trigger, context=context) + def action_produce_assign_service(self, cr, uid, ids, context=None): """ Changes procurement state to Running. @return: True