Rename osv into model on workflow

This commit is contained in:
Cédric Krier committed 2009-08-25 13:59:31 +02:00
1 parent 6df5fe2f0c
commit 54c79dddc5
6 files changed
+21 -9

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Rename osv into model on workflow
* Add logout method
* Move BrowseRecord cache onto the cursor
* Don't order search result if order value is []
+1 -1
View File
@@ -116,7 +116,7 @@ create table wkf
(
id serial,
name varchar,
osv varchar,
model varchar,
on_create bool,
primary key(id)
);
+1 -1
View File
@@ -108,7 +108,7 @@ create table wkf
(
id INTEGER PRIMARY KEY,
name VARCHAR,
osv VARCHAR,
model VARCHAR,
on_create BOOLEAN
);
+1 -1
View File
@@ -61,7 +61,7 @@ class ModelWorkflow(ModelStorage):
ids = [ids]
workflow_ids = workflow_obj.search(cursor, 0, [
('osv', '=', self._name),
('model', '=', self._name),
('on_create', '=', True),
], context=context)
for res_id in ids:
+14 -3
View File
@@ -1,4 +1,5 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Workflow"
import os
from trytond.model import ModelView, ModelSQL, fields
@@ -15,7 +16,7 @@ class Workflow(ModelSQL, ModelView):
_table = "wkf"
_description = __doc__
name = fields.Char('Name', required=True, translate=True)
osv = fields.Char('Resource Model', required=True, select=1)
model = fields.Char('Resource Model', required=True, select=1)
on_create = fields.Boolean('On Create', select=2)
activities = fields.One2Many('workflow.activity', 'workflow',
'Activities')
@@ -26,6 +27,16 @@ class Workflow(ModelSQL, ModelView):
'no_workflow_defined': 'No workflow defined!',
})
def init(self, cursor, module_name):
super(Workflow, self).init(cursor, module_name)
table = TableHandler(cursor, self, module_name)
# Migration from 1.2 rename osv into model
if table.column_exist('osv'):
cursor.execute('UPDATE "' + self._table + '" ' \
'SET model = osv')
table.drop_column('osv', exception=True)
def default_on_create(self, cursor, user, context=None):
return 1
@@ -524,7 +535,7 @@ class InstanceGraph(Report):
lang = lang_obj.browse(cursor, user, lang_id, context=context)
workflow_id = workflow_obj.search(cursor, user, [
('osv', '=', datas['model']),
('model', '=', datas['model']),
], limit=1, context=context)
if not workflow_id:
workflow_obj.raise_user_error(cursor, 'no_workflow_defined',
+3 -3
View File
@@ -12,8 +12,8 @@
<form string="Workflow" col="6">
<label name="name"/>
<field name="name"/>
<label name="osv"/>
<field name="osv"/>
<label name="model"/>
<field name="model"/>
<label name="on_create"/>
<field name="on_create"/>
<field name="activities" colspan="6"/>
@@ -28,7 +28,7 @@
<![CDATA[
<tree string="Workflow">
<field name="name" select="1"/>
<field name="osv" select="1"/>
<field name="model" select="1"/>
<field name="on_create"/>
</tree>
]]>