예제 #1
0
 def trg_trigger(self, uid, res_type, res_id, cr):
     cr.execute('select instance_id from wkf_triggers where res_id=%s and model=%s', (res_id,res_type))
     res = cr.fetchall()
     for (instance_id,) in res:
         cr.execute('select %s,res_type,res_id from wkf_instance where id=%s', (uid, instance_id,))
         ident = cr.fetchone()
         instance.update(cr, instance_id, ident)
예제 #2
0
 def trg_trigger(self, uid, res_type, res_id, cr):
     # If an unique ID is passed on parameter
     if isinstance(res_id, (int, long)):
         res_id = [res_id]
     cr.execute('select instance_id from wkf_triggers where res_id in %s and model=%s', (tuple(res_id),res_type))
     res = cr.fetchall()
     for (instance_id,) in res:
         cr.execute('select %s,res_type,res_id from wkf_instance where id=%s', (uid, instance_id,))
         ident = cr.fetchone()
         instance.update(cr, instance_id, ident)
예제 #3
0
    def trg_write(self, uid, res_type, res_id, cr):
        """
        Reevaluates the specified workflow instance. Thus if any condition for
        a transition have been changed in the backend, then running ``trg_write``
        will move the workflow over that transition.

        :param res_type: the model name
        :param res_id: the model instance id the workflow belongs to
        :param cr: a database cursor
        """
        ident = (uid,res_type,res_id)
        cr.execute('select id from wkf_instance where res_id=%s and res_type=%s and state=%s', (res_id or None,res_type or None, 'active'))
        for (id,) in cr.fetchall():
            instance.update(cr, id, ident)
예제 #4
0
    def trg_write(self, uid, res_type, res_id, cr):
        """
        Reevaluates the specified workflow instance. Thus if any condition for
        a transition have been changed in the backend, then running ``trg_write``
        will move the workflow over that transition.

        :param res_type: the model name
        :param res_id: the model instance id the workflow belongs to
        :param cr: a database cursor
        """
        ident = (uid,res_type,res_id)
        cr.execute('select id from wkf_instance where res_id=%s and res_type=%s and state=%s', (res_id or None,res_type or None, 'active'))
        for (id,) in cr.fetchall():
            instance.update(cr, id, ident)
예제 #5
0
    def trg_trigger(self, uid, res_type, res_id, cr):
        """
        Activate a trigger.

        If a workflow instance is waiting for a trigger from another model, then this
        trigger can be activated if its conditions are met.

        :param res_type: the model name
        :param res_id: the model instance id the workflow belongs to
        :param cr: a database cursor
        """
        cr.execute('select instance_id from wkf_triggers where res_id=%s and model=%s', (res_id,res_type))
        res = cr.fetchall()
        for (instance_id,) in res:
            cr.execute('select %s,res_type,res_id from wkf_instance where id=%s', (uid, instance_id,))
            ident = cr.fetchone()
            instance.update(cr, instance_id, ident)
예제 #6
0
    def trg_trigger(self, uid, res_type, res_id, cr):
        """
        Activate a trigger.

        If a workflow instance is waiting for a trigger from another model, then this
        trigger can be activated if its conditions are met.

        :param res_type: the model name
        :param res_id: the model instance id the workflow belongs to
        :param cr: a database cursor
        """
        cr.execute('select instance_id from wkf_triggers where res_id=%s and model=%s', (res_id,res_type))
        res = cr.fetchall()
        for (instance_id,) in res:
            cr.execute('select %s,res_type,res_id from wkf_instance where id=%s', (uid, instance_id,))
            ident = cr.fetchone()
            instance.update(cr, instance_id, ident)
예제 #7
0
 def trg_write(self, uid, res_type, res_id, cr):
     ident = (uid,res_type,res_id)
     cr.execute('select id from wkf_instance where res_id=%s and res_type=%s and state=%s', (res_id or None,res_type or None, 'active'))
     for (id,) in cr.fetchall():
         instance.update(cr, id, ident)