[MERGE] trunk-methflow-thu (refactor existing workflow methods in models)

bzr revid: rco@openerp.com-20130213151012-81kt1eyyp9xlid8f
This commit is contained in:
Raphael Collet 2013-02-13 16:10:12 +01:00
commit e3744cfdc8
3 changed files with 41 additions and 22 deletions

View File

@ -364,7 +364,7 @@ class pos_session(osv.osv):
ids = [ids]
this_record = self.browse(cr, uid, ids[0], context=context)
this_record._workflow_signal('open')
this_record.signal_workflow('open')
context.update(active_id=this_record.id)

View File

@ -373,14 +373,13 @@ class procurement_order(osv.osv):
self.message_post(cr, uid, [procurement.id], body=message, context=context)
return ok
def _workflow_trigger(self, cr, uid, ids, trigger, context=None):
""" Don't trigger workflow for the element specified in trigger
"""
wkf_op_key = 'workflow.%s.%s' % (trigger, self._name)
def step_workflow(self, cr, uid, ids, context=None):
""" Don't trigger workflow for the element specified in trigger """
wkf_op_key = 'workflow.trg_write.%s' % 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)
return super(procurement_order, self).step_workflow(cr, uid, ids, context=context)
def action_produce_assign_service(self, cr, uid, ids, context=None):
""" Changes procurement state to Running.

View File

@ -2947,15 +2947,25 @@ class stock_picking_in(osv.osv):
#override in order to redirect the check of acces rules on the stock.picking object
return self.pool.get('stock.picking').check_access_rule(cr, uid, ids, operation, context=context)
def _workflow_trigger(self, cr, uid, ids, trigger, context=None):
#override in order to trigger the workflow of stock.picking at the end of create, write and unlink operation
#instead of it's own workflow (which is not existing)
return self.pool.get('stock.picking')._workflow_trigger(cr, uid, ids, trigger, context=context)
def create_workflow(self, cr, uid, ids, context=None):
# overridden in order to trigger the workflow of stock.picking at the end of create,
# write and unlink operation instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').create_workflow(cr, uid, ids, context=context)
def _workflow_signal(self, cr, uid, ids, signal, context=None):
#override in order to fire the workflow signal on given stock.picking workflow instance
#instead of it's own workflow (which is not existing)
return self.pool.get('stock.picking')._workflow_signal(cr, uid, ids, signal, context=context)
def delete_workflow(self, cr, uid, ids, context=None):
# overridden in order to trigger the workflow of stock.picking at the end of create,
# write and unlink operation instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').delete_workflow(cr, uid, ids, context=context)
def step_workflow(self, cr, uid, ids, context=None):
# overridden in order to trigger the workflow of stock.picking at the end of create,
# write and unlink operation instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').step_workflow(cr, uid, ids, context=context)
def signal_workflow(self, cr, uid, ids, signal, context=None):
# overridden in order to fire the workflow signal on given stock.picking workflow instance
# instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').signal_workflow(cr, uid, ids, signal, context=context)
_columns = {
'backorder_id': fields.many2one('stock.picking.in', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
@ -2992,15 +3002,25 @@ class stock_picking_out(osv.osv):
#override in order to redirect the check of acces rules on the stock.picking object
return self.pool.get('stock.picking').check_access_rule(cr, uid, ids, operation, context=context)
def _workflow_trigger(self, cr, uid, ids, trigger, context=None):
#override in order to trigger the workflow of stock.picking at the end of create, write and unlink operation
#instead of it's own workflow (which is not existing)
return self.pool.get('stock.picking')._workflow_trigger(cr, uid, ids, trigger, context=context)
def create_workflow(self, cr, uid, ids, context=None):
# overridden in order to trigger the workflow of stock.picking at the end of create,
# write and unlink operation instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').create_workflow(cr, uid, ids, context=context)
def _workflow_signal(self, cr, uid, ids, signal, context=None):
#override in order to fire the workflow signal on given stock.picking workflow instance
#instead of it's own workflow (which is not existing)
return self.pool.get('stock.picking')._workflow_signal(cr, uid, ids, signal, context=context)
def delete_workflow(self, cr, uid, ids, context=None):
# overridden in order to trigger the workflow of stock.picking at the end of create,
# write and unlink operation instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').delete_workflow(cr, uid, ids, context=context)
def step_workflow(self, cr, uid, ids, context=None):
# overridden in order to trigger the workflow of stock.picking at the end of create,
# write and unlink operation instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').step_workflow(cr, uid, ids, context=context)
def signal_workflow(self, cr, uid, ids, signal, context=None):
# overridden in order to fire the workflow signal on given stock.picking workflow instance
# instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').signal_workflow(cr, uid, ids, signal, context=context)
_columns = {
'backorder_id': fields.many2one('stock.picking.out', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),