Ejemplo n.º 1
0
def validate(cr, inst_id, ident, signal, force_running=False):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
    stack = []
    for witem in cr.dictfetchall():
        stack = []
        workitem.process(cr, witem, ident, signal, force_running, stack=stack)
        # An action is returned
    _update_end(cr, inst_id, ident)
    return stack and stack[0] or False
Ejemplo n.º 2
0
def validate(cr, inst_id, ident, signal, force_running=False):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id, ))
    stack = []
    for witem in cr.dictfetchall():
        stack = []
        workitem.process(cr, witem, ident, signal, force_running, stack=stack)
        # An action is returned
    _update_end(cr, inst_id, ident)
    return stack and stack[0] or False
Ejemplo n.º 3
0
def validate(cr, inst_id, ident, signal, force_running=False):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
    stack = []
    result = cr.dictfetchall()
    _logger.debug('instance validate: {}'.format(result))
    for witem in result:
        stack = []
        workitem.process(cr, witem, ident, signal, force_running, stack=stack)
        # An action is returned
    _update_end(cr, inst_id, ident)
    return stack and stack[0] or False
Ejemplo n.º 4
0
def validate(cr, inst_id, ident, signal, force_running=False):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
    stack = []
    result = cr.dictfetchall()
    _logger.debug('instance validate: {}'.format(result))
    for witem in result:
        stack = []
        workitem.process(cr, witem, ident, signal, force_running, stack=stack)
        # An action is returned
    _update_end(cr, inst_id, ident)
    return stack and stack[0] or False
Ejemplo n.º 5
0
def update(cr, inst_id, ident):
    """ Run workitem.process on all workitems associated with the instance id

    @param cr: database handle
    @param inst_id: instance ID of target record
    @param ident: tuple of (uid, dotted model name, resource id )

    Returns: True if all workitems related to an instance are complete
    """
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id, ))
    for witem in cr.dictfetchall():
        stack = []
        workitem.process(cr, witem, ident, stack=stack)
    return _update_end(cr, inst_id, ident)
Ejemplo n.º 6
0
def validate(cr, inst_id, ident, signal, force_running=False):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
    stack = []
    for i, witem in enumerate(cr.dictfetchall()):
        stack = []
        if i > 0:
            # test if previous workitem has already processed this one
            cr.execute("select id from wkf_workitem where id=%s", (witem['id'],))
            if not cr.fetchone():
                continue
        workitem.process(cr, witem, ident, signal, force_running, stack=stack)
        # An action is returned
    _update_end(cr, inst_id, ident)
    return stack and stack[0] or False
Ejemplo n.º 7
0
def validate(cr, inst_id, ident, signal, force_running=False):
    """ Run any processing associated with a record

    @param cr: database handle
    @param ident: tuple of (uid, dotted model name, resource id )
    @param signal:
    @param force_running:

    """

    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id, ))
    stack = []
    for witem in cr.dictfetchall():
        stack = []
        workitem.process(cr, witem, ident, signal, force_running, stack=stack)
        # An action is returned
    _update_end(cr, inst_id, ident)
    return stack and stack[0] or False
Ejemplo n.º 8
0
def update(cr, inst_id, ident):
    cr.execute("SELECT * FROM wkf_workitem WHERE inst_id=%s", (inst_id,))
    res = cr.dictfetchall()
    _logger.debug('instance update: {}'.format(res))
    if tools.config['log_level'] == 'debug':
        cr.execute("SELECT name FROM wkf_activity WHERE id={}".format(res[0]['act_id']))
        activity = cr.dictfetchone()
        cr.execute("SELECT res_type,res_id FROM wkf_instance WHERE id={}".format(res[0]['inst_id']))
        instance = cr.dictfetchone()
        _logger.debug(
            "> > > Workflow '{instance[res_type]}, {instance[res_id]}' node: '{activity[name]}'".format(
                instance=instance, activity=activity
            )
        )
    for witem in res:
        stack = []
        workitem.process(cr, witem, ident, stack=stack)
    return _update_end(cr, inst_id, ident)
Ejemplo n.º 9
0
def update(cr, inst_id, ident):
    cr.execute("SELECT * FROM wkf_workitem WHERE inst_id=%s", (inst_id,))
    res = cr.dictfetchall()
    _logger.debug('instance update: {}'.format(res))
    if tools.config['log_level'] == 'debug':
        cr.execute("SELECT name FROM wkf_activity WHERE id={}".format(res[0]['act_id']))
        activity = cr.dictfetchone()
        cr.execute("SELECT res_type,res_id FROM wkf_instance WHERE id={}".format(res[0]['inst_id']))
        instance = cr.dictfetchone()
        _logger.debug(
            "> > > Workflow '{instance[res_type]}, {instance[res_id]}' node: '{activity[name]}'".format(
                instance=instance, activity=activity
            )
        )
    for witem in res:
        stack = []
        workitem.process(cr, witem, ident, stack=stack)
    return _update_end(cr, inst_id, ident)
Ejemplo n.º 10
0
def update(cr, inst_id, ident):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
    for witem in cr.dictfetchall():
        stack = []
        workitem.process(cr, witem, ident, stack=stack)
    return _update_end(cr, inst_id, ident)
Ejemplo n.º 11
0
def update(cr, inst_id, ident):
    cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id, ))
    for witem in cr.dictfetchall():
        stack = []
        workitem.process(cr, witem, ident, stack=stack)
    return _update_end(cr, inst_id, ident)