processus module has been renamed to process
[odoo/odoo.git] / addons / process / process.py
1 # -*- encoding: utf-8 -*-
2 ##############################################################################
3 #
4 # Copyright (c) 2005-TODAY TINY SPRL. (http://tiny.be) All Rights Reserved.
5 #
6 # WARNING: This program as such is intended to be used by professional
7 # programmers who take the whole responsability of assessing all potential
8 # consequences resulting from its eventual inadequacies and bugs
9 # End users who are looking for a ready-to-use solution with commercial
10 # garantees and support are strongly adviced to contract a Free Software
11 # Service Company
12 #
13 # This program is Free Software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; either version 2
16 # of the License, or (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26 #
27 ##############################################################################
28
29 import netsvc
30 from osv import fields, osv
31
32
33 class process_process(osv.osv):
34     _name = "process.process"
35     _description = "Process"
36     _columns = {
37         'name': fields.char('Name', size=30,required=True),
38         'active': fields.boolean('Active'),
39         'note': fields.text('Notes'),
40         'node_ids': fields.one2many('process.node', 'process_id', 'Nodes')
41     }
42     _defaults = {
43         'active' : lambda *a: True,
44     }
45 process_process()
46
47 class process_node(osv.osv):
48     _name = 'process.node'
49     _description ='Process Nodes'
50     _columns = {
51         'name': fields.char('Name', size=30,required=True),
52         'process_id': fields.many2one('process.process', 'Process', required=True),
53         'kind': fields.selection([('state','State'),('router','Router'),('subflow','Subflow')],'Kind of Node', required=True),
54         'menu_id': fields.many2one('ir.ui.menu', 'Related Menu'),
55         'note': fields.text('Notes'),
56         'model_id': fields.many2one('ir.model', 'Object', ondelete='set null'),
57         'model_states': fields.char('States Expression', size=128),
58         'flow_start': fields.boolean('Starting Flow'),
59         'transition_in': fields.one2many('process.transition', 'node_to_id', 'Starting Transitions'),
60         'transition_out': fields.one2many('process.transition', 'node_from_id', 'Ending Transitions'),
61     }
62     _defaults = {
63         'kind': lambda *args: 'state',
64         'model_states': lambda *args: False,
65         'flow_start': lambda *args: False,
66     }
67 process_node()
68
69 class process_transition(osv.osv):
70     _name = 'process.transition'
71     _description ='Process Transitions'
72     _columns = {
73         'name': fields.char('Name', size=32, required=True),
74         'node_from_id': fields.many2one('process.node', 'Origin Node', required=True, ondelete='cascade'),
75         'node_to_id': fields.many2one('process.node', 'Destination Node', required=True, ondelete='cascade'),
76         'transition_ids': fields.many2many('workflow.transition', 'process_transition_ids', 'trans1_id', 'trans2_id', 'Workflow Transitions'),
77         'note': fields.text('Description'),
78         'action_ids': fields.one2many('process.transition.action', 'transition_id', 'Buttons')
79     }
80     _defaults = {
81     }
82 process_transition()
83
84 class process_transition_action(osv.osv):
85     _name = 'process.transition.action'
86     _description ='Process Transitions Actions'
87     _columns = {
88         'name': fields.char('Name', size=32, required=True),
89         'state': fields.selection([('dummy','Dummy'),('method','Object Method'),('workflow','Workflow Trigger'),('action','Action')], 'Type', required=True),
90         'action': fields.char('Action ID', size=64, states={
91             'dummy':[('readonly',1)],
92             'method':[('required',1)],
93             'workflow':[('required',1)],
94             'action':[('required',1)],
95         },),
96         'transition_id': fields.many2one('process.transition', 'Transition', required=True, ondelete='cascade')
97     }
98     _defaults = {
99         'state': lambda *args: 'dummy',
100     }
101 process_transition_action()
102
103
104
105
106 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
107