Пример #1
0
                            WHERE res_id=%s AND wkf_id=%s \
                            ORDER BY state LIMIT 1',
                            (res_id, wkfinfo['id']))
            inst_id = cr.fetchone()

            cr.execute('select act_id,count(*) from wkf_workitem where inst_id=%s group by act_id', (inst_id,))
            workitems = dict(cr.fetchall())
        return {'wkf': wkfinfo, 'workitems':  workitems}

    def create(self, cr, user, vals, context=None):
        if not context:
            context={}
        openerp.workflow.clear_cache(cr, user)
        return super(workflow, self).create(cr, user, vals, context=context)

workflow()

class wkf_activity(osv.osv):
    _name = "workflow.activity"
    _table = "wkf_activity"
    _order = "name"
    _columns = {
        'name': fields.char('Name', required=True),
        'wkf_id': fields.many2one('workflow', 'Workflow', required=True, select=True, ondelete='cascade'),
        'split_mode': fields.selection([('XOR', 'Xor'), ('OR','Or'), ('AND','And')], 'Split Mode', size=3, required=True),
        'join_mode': fields.selection([('XOR', 'Xor'), ('AND', 'And')], 'Join Mode', size=3, required=True),
        'kind': fields.selection([('dummy', 'Dummy'), ('function', 'Function'), ('subflow', 'Subflow'), ('stopall', 'Stop All')], 'Kind', required=True),
        'action': fields.text('Python Action'),
        'action_id': fields.many2one('ir.actions.server', 'Server Action', ondelete='set null'),
        'flow_start': fields.boolean('Flow Start'),
        'flow_stop': fields.boolean('Flow Stop'),
Пример #2
0
            inst_id = cr.fetchone()

            cr.execute(
                'select act_id,count(*) from wkf_workitem where inst_id=%s group by act_id',
                (inst_id, ))
            workitems = dict(cr.fetchall())
        return {'wkf': wkfinfo, 'workitems': workitems}

    def create(self, cr, user, vals, context=None):
        if not context:
            context = {}
        openerp.workflow.clear_cache(cr, user)
        return super(workflow, self).create(cr, user, vals, context=context)


workflow()


class wkf_activity(osv.osv):
    _name = "workflow.activity"
    _table = "wkf_activity"
    _order = "name"
    _columns = {
        'name':
        fields.char('Name', required=True),
        'wkf_id':
        fields.many2one('workflow',
                        'Workflow',
                        required=True,
                        select=True,
                        ondelete='cascade'),