From 78fd7d490a8b2d0d9a4967faa3f42b48825fc91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 16 Jan 2008 21:06:31 +0100 Subject: [PATCH] Better action implementation - Better naming - Remove inherit from sql and use inherit from ORM - Remove table creation from init.sql as it is no needs --- trytond/init.sql | 40 -------- trytond/ir/actions.py | 159 ++++++++++++++++++------------ trytond/ir/actions.xml | 161 ++++++++++++++++++------------- trytond/ir/attachment.xml | 8 +- trytond/ir/cron.xml | 6 +- trytond/ir/exports.xml | 8 +- trytond/ir/model.xml | 18 ++-- trytond/ir/module/category.xml | 6 +- trytond/ir/module/module.py | 2 +- trytond/ir/module/module.xml | 12 +-- trytond/ir/module/repository.xml | 8 +- trytond/ir/property.xml | 16 +-- trytond/ir/rule.xml | 6 +- trytond/ir/sequence.xml | 16 +-- trytond/ir/translation.xml | 6 +- trytond/ir/ui/menu.py | 15 +-- trytond/ir/ui/menu.xml | 10 +- trytond/ir/ui/view.xml | 16 +-- trytond/ir/values.xml | 8 +- trytond/report/report.py | 2 +- trytond/res/lang.xml | 4 +- trytond/res/request.xml | 8 +- trytond/res/user.py | 34 +++++-- trytond/res/users.xml | 30 +++--- trytond/tools/convert.py | 24 +++-- trytond/trytond.py | 5 - trytond/web_service/db.py | 1 - trytond/workflow/workflow.xml | 28 +++--- 28 files changed, 349 insertions(+), 308 deletions(-) diff --git a/trytond/init.sql b/trytond/init.sql index 266346a8b9..e6b3fb4866 100644 --- a/trytond/init.sql +++ b/trytond/init.sql @@ -56,46 +56,6 @@ CREATE TABLE ir_model_fields ( ------------------------------------------------------------------------- -- Actions ------------------------------------------------------------------------- - -CREATE TABLE ir_actions ( - id serial NOT NULL, - name varchar(64) DEFAULT ''::varchar NOT NULL, - "type" varchar(64) DEFAULT 'window'::varchar NOT NULL, - usage varchar(32) DEFAULT null, - primary key(id) -); - -CREATE TABLE ir_act_window ( - view_id integer, - res_model varchar(64), - view_type varchar(16), - "domain" varchar(127), - primary key(id) -) -INHERITS (ir_actions); - -CREATE TABLE ir_act_report ( - model varchar(64) NOT NULL, - report_name varchar(64) NOT NULL, - report varchar(64), - auto boolean default true, - primary key(id) -) -INHERITS (ir_actions); - -CREATE TABLE ir_act_wizard ( - wiz_name varchar(64) NOT NULL, - primary key(id) -) -INHERITS (ir_actions); - -CREATE TABLE ir_act_url ( - url text NOT NULL, - target varchar(64) NOT NULL, - primary key(id) -) -INHERITS (ir_actions); - CREATE TABLE ir_ui_view ( id serial NOT NULL, name varchar(64) DEFAULT ''::varchar NOT NULL, diff --git a/trytond/ir/actions.py b/trytond/ir/actions.py index 2a95d8e0e4..047ce829aa 100644 --- a/trytond/ir/actions.py +++ b/trytond/ir/actions.py @@ -1,17 +1,16 @@ -"Actions" +"Action" from trytond.osv import fields, OSV from trytond.tools import file_open -class Actions(OSV): - "Actions" - _name = 'ir.actions.actions' - _table = 'ir_actions' +class Action(OSV): + "Action" + _name = 'ir.action' _description = __doc__ _columns = { - 'name': fields.char('Action Name', required=True, size=64), - 'type': fields.char('Action Type', required=True, size=32), - 'usage': fields.char('Action Usage', size=32), + 'name': fields.char('Name', required=True, size=64, translate=True), + 'type': fields.char('Type', required=True, size=32, readonly=True), + 'usage': fields.char('Usage', size=32), 'keywords': fields.one2many('ir.action.keyword', 'action', 'Keywords'), } @@ -19,7 +18,28 @@ class Actions(OSV): 'usage': lambda *a: False, } -Actions() + def get_action_id(self, cursor, user, action_id, context=None): + if self.search(cursor, user, [ + ('id', '=', action_id), + ], context=context): + return action_id + for action_type in ( + 'ir.action.report', + 'ir.action.act_window', + 'ir.action.wizard', + 'ir.action.url', + ): + action_obj = self.pool.get(action_type) + action_id2 = action_obj.search(cursor, user, [ + ('id', '=', action_id), + ], context=context) + if action_id2: + action = action_obj.browse(cursor, user, action_id2[0], + context=context) + return action.action.id + return False + +Action() class ActionKeyword(OSV): @@ -44,10 +64,28 @@ class ActionKeyword(OSV): ('form_relate', 'Form relate'), ], string='Keyword', required=True), 'model': fields.Reference('Model', selection=_models_get, size=128), - 'action': fields.many2one('ir.actions.actions', 'Action', + 'action': fields.many2one('ir.action', 'Action', ondelete='CASCADE'), } + def _convert_vals(self, cursor, user, vals, context=None): + vals = vals.copy() + action_obj = self.pool.get('ir.action') + if 'action' in vals: + vals['action'] = action_obj.get_action_id(cursor, user, + vals['action'], context=context) + return vals + + def create(self, cursor, user, vals, context=None): + vals = self._convert_vals(cursor, user, vals, context=context) + return super(ActionKeyword, self).create(cursor, user, vals, + context=context) + + def write(self, cursor, user, ids, vals, context=None): + vals = self._convert_vals(cursor, user, vals, context=context) + return super(ActionKeyword, self).write(cursor, user, ids, vals, + context=context) + def get_keyword(self, cursor, user, keyword, value, context=None): res = [] model, model_id = value @@ -64,18 +102,23 @@ class ActionKeyword(OSV): ], context=context)) for action_keyword in self.browse(cursor, user, action_keyword_ids, context=context): - res.append(self.pool.get(action_keyword.action.type)\ - .read(cursor, user, action_keyword.action.id, - context=context)) - if action_keyword.action.type == 'ir.actions.report': - del res[-1]['report_content_data'] - del res[-1]['report_content'] + action_obj = self.pool.get(action_keyword.action.type) + action_id = action_obj.search(cursor, user, [ + ('action', '=', action_keyword.action.id), + ], context=context) + if action_id: + res.append(action_obj.read(cursor, user, action_id[0], + context=context)) + if action_keyword.action.type == 'ir.action.report': + del res[-1]['report_content_data'] + del res[-1]['report_content'] return res ActionKeyword() -class ActionsReport(OSV): - "Actions report" + +class ActionReport(OSV): + "Action report" def _report_content(self, cursor, user, ids, name, arg, context=None): res = {} @@ -93,13 +136,11 @@ class ActionsReport(OSV): context=None): self.write(cursor, user, obj_id, {name+'_data': value}, context=context) - _name = 'ir.actions.report' - _table = 'ir_act_report' - _sequence = 'ir_actions_id_seq' + _name = 'ir.action.report' + _sequence = 'ir_action_id_seq' _description = __doc__ + _inherits = {'ir.action': 'action'} _columns = { - 'name': fields.char('Name', size=64, required=True, translate=True), - 'type': fields.char('Report Type', size=32, required=True), 'model': fields.char('Model', size=64, required=True), 'report_name': fields.char('Internal Name', size=64, required=True), 'report': fields.Char('Path', size=128), @@ -107,21 +148,22 @@ class ActionsReport(OSV): 'report_content': fields.function(_report_content, fnct_inv=_report_content_inv, method=True, type='binary', string='Content',), + 'action': fields.many2one('ir.action', 'Action', required=True), } _defaults = { - 'type': lambda *a: 'ir.actions.report', + 'type': lambda *a: 'ir.action.report', 'report_content': lambda *a: False, } -ActionsReport() +ActionReport() -class ActionsActWindow(OSV): - "Actions act window" - _name = 'ir.actions.act_window' - _table = 'ir_act_window' - _sequence = 'ir_actions_id_seq' +class ActionActWindow(OSV): + "Action act window" + _name = 'ir.action.act_window' + _sequence = 'ir_action_id_seq' _description = __doc__ + _inherits = {'ir.action': 'action'} def _views_get_fnc(self, cursor, user, ids, name, arg, context=None): res = {} @@ -141,8 +183,6 @@ class ActionsActWindow(OSV): return res _columns = { - 'name': fields.char('Action Name', size=64, translate=True), - 'type': fields.char('Action Type', size=32, required=True), 'domain': fields.char('Domain Value', size=250), 'context': fields.char('Context Value', size=250), 'res_model': fields.char('Model', size=64), @@ -150,7 +190,7 @@ class ActionsActWindow(OSV): 'view_type': fields.selection([('tree','Tree'), ('form','Form')], string='Type of view'), 'usage': fields.char('Action Usage', size=32), - 'view_ids': fields.one2many('ir.actions.act_window.view', + 'view_ids': fields.one2many('ir.action.act_window.view', 'act_window_id', 'Views'), 'views': fields.function(_views_get_fnc, method=True, type='binary', string='Views'), @@ -158,22 +198,22 @@ class ActionsActWindow(OSV): help='Default limit for the list view'), 'auto_refresh': fields.integer('Auto-Refresh', help='Add an auto-refresh on the view'), + 'action': fields.many2one('ir.action', 'Action', required=True), } _defaults = { - 'type': lambda *a: 'ir.actions.act_window', + 'type': lambda *a: 'ir.action.act_window', 'view_type': lambda *a: 'form', 'context': lambda *a: '{}', 'limit': lambda *a: 80, 'auto_refresh': lambda *a: 0, } -ActionsActWindow() +ActionActWindow() -class ActionsActWindowView(OSV): - "Actions act window view" - _name = 'ir.actions.act_window.view' - _table = 'ir_act_window_view' +class ActionActWindowView(OSV): + "Action act window view" + _name = 'ir.action.act_window.view' _rec_name = 'view_id' _description = __doc__ _columns = { @@ -184,7 +224,7 @@ class ActionsActWindowView(OSV): ('form', 'Form'), ('graph', 'Graph'), ('calendar', 'Calendar')), string='Type of view', required=True), - 'act_window_id': fields.many2one('ir.actions.act_window', 'Action', + 'act_window_id': fields.many2one('ir.action.act_window', 'Action', ondelete='CASCADE'), 'multi': fields.boolean('On multiple doc.', help="If set to true, the action will not be displayed \n" \ @@ -195,46 +235,43 @@ class ActionsActWindowView(OSV): } _order = 'sequence' -ActionsActWindowView() +ActionActWindowView() -class ActionsWizard(OSV): - "Actions wizard" - _name = 'ir.actions.wizard' - _table = 'ir_act_wizard' - _sequence = 'ir_actions_id_seq' +class ActionWizard(OSV): + "Action wizard" + _name = 'ir.action.wizard' + _sequence = 'ir_action_id_seq' _description = __doc__ + _inherits = {'ir.action': 'action'} _columns = { - 'name': fields.char('Wizard info', size=64, required=True, - translate=True), - 'type': fields.char('Action type', size=32, required=True), 'wiz_name': fields.char('Wizard name', size=64, required=True), + 'action': fields.many2one('ir.action', 'Action', required=True), } _defaults = { - 'type': lambda *a: 'ir.actions.wizard', + 'type': lambda *a: 'ir.action.wizard', } -ActionsWizard() +ActionWizard() -class ActionsURL(OSV): - "Actions URL" - _name = 'ir.actions.url' - _table = 'ir_act_url' - _sequence = 'ir_actions_id_seq' +class ActionURL(OSV): + "Action URL" + _name = 'ir.action.url' + _sequence = 'ir_action_id_seq' _description = __doc__ + _inherits = {'ir.action': 'action'} _columns = { - 'name': fields.char('Action Name', size=64, translate=True), - 'type': fields.char('Action Type', size=32, required=True), 'url': fields.text('Action Url',required=True), 'target': fields.selection([ ('new', 'New Window'), ('self', 'This Window'), - ], 'Action Target', required=True) + ], 'Action Target', required=True), + 'action': fields.many2one('ir.action', 'Action', required=True), } _defaults = { - 'type': lambda *a: 'ir.actions.act_url', + 'type': lambda *a: 'ir.action.act_url', 'target': lambda *a: 'new', } -ActionsURL() +ActionURL() diff --git a/trytond/ir/actions.xml b/trytond/ir/actions.xml index 93494ede0a..72398a6781 100644 --- a/trytond/ir/actions.xml +++ b/trytond/ir/actions.xml @@ -1,9 +1,9 @@ - - - ir.actions.actions + + + ir.action form - - ir.actions.actions + + ir.action tree - + Actions - ir.actions.act_window - ir.actions.actions + ir.action.act_window + ir.action form - + tree - - + + - + form - - + + - - - ir.actions.report + + + ir.action.report form + + + + +
+ + + + ]]>
- - ir.actions.report + + ir.action.report tree - + Reports - ir.actions.act_window - ir.actions.report + ir.action.act_window + ir.action.report form - + tree - - + + - + form - - + + - - - ir.actions.act_window + + + ir.action.act_window form + + + + +
+ + + + ]]>
- - ir.actions.act_window + + ir.action.act_window tree - + Window Actions - ir.actions.act_window - ir.actions.act_window + ir.action.act_window + ir.action.act_window form - + tree - - + + - + form - - + + - - - ir.actions.wizard + + + ir.action.wizard form + + + + +
+ + + + ]]>
- - ir.actions.wizard + + ir.action.wizard tree - + Wizards - ir.actions.act_window - ir.actions.wizard + ir.action.act_window + ir.action.wizard form - + tree - - + + - + form - - + + - +
diff --git a/trytond/ir/attachment.xml b/trytond/ir/attachment.xml index eff7ccdb65..be36dd69df 100644 --- a/trytond/ir/attachment.xml +++ b/trytond/ir/attachment.xml @@ -32,20 +32,20 @@ ]]> - + Attachments - ir.actions.act_window + ir.action.act_window ir.attachment form - tree - form diff --git a/trytond/ir/cron.xml b/trytond/ir/cron.xml index 345deacb3b..fbd197f759 100644 --- a/trytond/ir/cron.xml +++ b/trytond/ir/cron.xml @@ -42,20 +42,20 @@ ]]> - + Scheduled Actions ir.cron form {'active_test': False} - tree - form diff --git a/trytond/ir/exports.xml b/trytond/ir/exports.xml index 249b9aaf73..520d5d4384 100644 --- a/trytond/ir/exports.xml +++ b/trytond/ir/exports.xml @@ -26,20 +26,20 @@ ]]> - + Exports - ir.actions.act_window + ir.action.act_window ir.exports form - tree - form diff --git a/trytond/ir/model.xml b/trytond/ir/model.xml index 1506561df7..d1f291bd0c 100644 --- a/trytond/ir/model.xml +++ b/trytond/ir/model.xml @@ -36,19 +36,19 @@ ]]> - + Models ir.model form - tree - form @@ -84,19 +84,19 @@ ]]> - + Fields ir.model.fields form - tree - form @@ -136,19 +136,19 @@ ]]> - + Models Access ir.model.access form - tree - form diff --git a/trytond/ir/module/category.xml b/trytond/ir/module/category.xml index 101a56eee3..0a2a32ef65 100644 --- a/trytond/ir/module/category.xml +++ b/trytond/ir/module/category.xml @@ -25,14 +25,14 @@ ]]> - + Categories - ir.actions.act_window + ir.action.act_window ir.module.category tree [('parent_id', '=', False)] - tree diff --git a/trytond/ir/module/module.py b/trytond/ir/module/module.py index a202f8a934..e4376fbb8f 100644 --- a/trytond/ir/module/module.py +++ b/trytond/ir/module/module.py @@ -576,7 +576,7 @@ class ModuleUpdateList(Wizard): 'view_mode': 'tree,form', 'res_model': 'ir.module.module', 'view_id': False, - 'type': 'ir.actions.act_window', + 'type': 'ir.action.act_window', } def _get_repositories(self, cr, uid, data, context): diff --git a/trytond/ir/module/module.xml b/trytond/ir/module/module.xml index 42da95fded..2ee04b0e5b 100644 --- a/trytond/ir/module/module.xml +++ b/trytond/ir/module/module.xml @@ -70,20 +70,20 @@ ]]> - + Modules - ir.actions.act_window + ir.action.act_window ir.module.module form - tree - form @@ -97,7 +97,7 @@ - + Update Module List ir.module.module.update_list @@ -131,7 +131,7 @@ action="act_module_update_list" type="wizard" id="menu_module_update_list"/> - + Install / Upgrade Modules ir.module.module.install_upgrade diff --git a/trytond/ir/module/repository.xml b/trytond/ir/module/repository.xml index 664d85357f..aad4836eb3 100644 --- a/trytond/ir/module/repository.xml +++ b/trytond/ir/module/repository.xml @@ -30,20 +30,20 @@ ]]> - + Repositories - ir.actions.act_window + ir.action.act_window ir.module.repository form - tree - form diff --git a/trytond/ir/property.xml b/trytond/ir/property.xml index 2a46051bdd..d06a44a41f 100644 --- a/trytond/ir/property.xml +++ b/trytond/ir/property.xml @@ -30,21 +30,21 @@ ]]> - + Default properties - ir.actions.act_window + ir.action.act_window ir.property form [('res_id','=',False)] - tree - form @@ -53,20 +53,20 @@ - + Properties - ir.actions.act_window + ir.action.act_window ir.property form - tree - form diff --git a/trytond/ir/rule.xml b/trytond/ir/rule.xml index a0f93e90ed..a6ccaee5a2 100644 --- a/trytond/ir/rule.xml +++ b/trytond/ir/rule.xml @@ -34,19 +34,19 @@ ]]> - + Record Rules ir.rule.group form - tree - form diff --git a/trytond/ir/sequence.xml b/trytond/ir/sequence.xml index c3fdeba0f8..5e0811aede 100644 --- a/trytond/ir/sequence.xml +++ b/trytond/ir/sequence.xml @@ -39,21 +39,21 @@ ]]> - + Sequences - ir.actions.act_window + ir.action.act_window ir.sequence form {'active_test': False} - tree - form @@ -86,21 +86,21 @@ ]]> - Sequence Types - ir.actions.act_window + ir.action.act_window ir.sequence.type form - tree - form diff --git a/trytond/ir/translation.xml b/trytond/ir/translation.xml index d0e5977aa0..daaf1a8597 100644 --- a/trytond/ir/translation.xml +++ b/trytond/ir/translation.xml @@ -32,19 +32,19 @@ ]]> - + Translations ir.translation form - tree - form diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index efc20a9a37..268966a071 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -220,11 +220,14 @@ class UIMenu(OSV): if action_keyword_ids: action_keyword_obj.unlink(cursor, user, action_keyword_ids, context=ctx) - action_id = value.split(',')[1] + action_type, action_id = value.split(',') + action_obj = self.pool.get(action_type) + action = action_obj.browse(cursor, user, int(action_id), + context=context) action_keyword_obj.create(cursor, user, { 'keyword': 'tree_open', 'model': self._name + ',' + str(menu_id), - 'action': action_id, + 'action': action.action.id, }, context=ctx) _columns = { @@ -240,10 +243,10 @@ class UIMenu(OSV): 'action': fields.function(_action, fnct_inv=_action_inv, method=True, type='reference', string='Action', selection=[ - ('ir.actions.report.custom', 'ir.actions.report.custom'), - ('ir.actions.report.xml', 'ir.actions.report.xml'), - ('ir.actions.act_window', 'ir.actions.act_window'), - ('ir.actions.wizard', 'ir.actions.wizard'), + ('ir.action.report', 'ir.action.report'), + ('ir.action.act_window', 'ir.action.act_window'), + ('ir.action.wizard', 'ir.action.wizard'), + ('ir.action.url', 'ir.action.url'), ]), } _defaults = { diff --git a/trytond/ir/ui/menu.xml b/trytond/ir/ui/menu.xml index 16b966406f..190b3a8ac9 100644 --- a/trytond/ir/ui/menu.xml +++ b/trytond/ir/ui/menu.xml @@ -13,14 +13,14 @@ child_id - + Menu ir.ui.menu tree menu - tree @@ -56,19 +56,19 @@ ]]> - + Menus ir.ui.menu form - tree - form diff --git a/trytond/ir/ui/view.xml b/trytond/ir/ui/view.xml index f64569404a..0c33b04bf3 100644 --- a/trytond/ir/ui/view.xml +++ b/trytond/ir/ui/view.xml @@ -30,19 +30,19 @@ ]]> - + Views - ir.actions.act_window + ir.action.act_window ir.ui.view - tree - form @@ -77,19 +77,19 @@ ]]> - + View Shortcuts - ir.actions.act_window + ir.action.act_window ir.ui.view_sc - tree - form diff --git a/trytond/ir/values.xml b/trytond/ir/values.xml index 7379f9d144..f54a9c858d 100644 --- a/trytond/ir/values.xml +++ b/trytond/ir/values.xml @@ -35,20 +35,20 @@ ]]> - + Values - ir.actions.act_window + ir.action.act_window ir.values form - tree - form diff --git a/trytond/report/report.py b/trytond/report/report.py index c20bcd24b2..32abd04f58 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -130,7 +130,7 @@ class Report(object): super(Report, self).__init__() def execute(self, cursor, user, ids, datas, context=None): - action_report_obj = self.pool.get('ir.actions.report') + action_report_obj = self.pool.get('ir.action.report') action_report_ids = action_report_obj.search(cursor, user, [ ('report_name', '=', self._name) ], context=context) diff --git a/trytond/res/lang.xml b/trytond/res/lang.xml index 5d9064d50d..89ff58cfe3 100644 --- a/trytond/res/lang.xml +++ b/trytond/res/lang.xml @@ -20,13 +20,13 @@ ]]> - + Languages res.lang form {'active_test': False} - tree diff --git a/trytond/res/request.xml b/trytond/res/request.xml index 0caf94e875..ff6978a2ce 100644 --- a/trytond/res/request.xml +++ b/trytond/res/request.xml @@ -61,20 +61,20 @@ ]]> - + Requests - ir.actions.act_window + ir.action.act_window res.request form - tree - form diff --git a/trytond/res/user.py b/trytond/res/user.py index 1c573a729c..376545b7e7 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -22,10 +22,6 @@ class Group(OSV): ] def write(self, cursor, user, ids, vals, context=None): - if 'name' in vals: - if vals['name'].startswith('-'): - raise ExceptOSV('Error', - 'The name of the group can not start with "-"') res = super(Group, self).write(cursor, user, ids, vals, context=context) # Restart the cache on the company_get method @@ -70,8 +66,8 @@ class User(OSV): 'signature': fields.Text('Signature', size=64), #'address_id': fields.Many2One('res.partner.address', 'Address'), 'active': fields.Boolean('Active'), - 'action_id': fields.Many2One('ir.actions.actions', 'Home Action'), - 'menu_id': fields.Many2One('ir.actions.actions', 'Menu Action'), + 'action_id': fields.Many2One('ir.action', 'Home Action'), + 'menu_id': fields.Many2One('ir.action', 'Menu Action'), 'groups_id': fields.Many2Many('res.group', 'res_group_user_rel', 'uid', 'gid', 'Groups'), 'roles_id': fields.Many2Many('res.role', 'res_role_user_rel', @@ -95,7 +91,23 @@ class User(OSV): # return company_id # company_get = Cache()(company_get) + def _convert_vals(self, cursor, user, vals, context=None): + vals = vals.copy() + action_obj = self.pool.get('ir.action') + if 'action_id' in vals: + vals['action_id'] = action_obj.get_action_id(cursor, user, + vals['action_id'], context=context) + if 'menu_id' in vals: + vals['menu_id'] = action_obj.get_action_id(cursor, user, + vals['menu_id'], context=context) + return vals + + def create(self, cursor, user, vals, context=None): + vals = self._convert_vals(cursor, user, vals, context=context) + return super(User, self).create(cursor, user, vals, context=context) + def write(self, cursor, user, ids, vals, context=None): + vals = self._convert_vals(cursor, user, vals, context=context) res = super(User, self).write(cursor, user, ids, vals, context=context) # Restart the cache for company_get and domain_get method # self.company_get() @@ -135,9 +147,11 @@ User() class Group2(Group): - _columns = { - 'users': fields.many2many('res.user', 'res_group_user_rel', 'gid', - 'uid', 'Users'), - } + + def __init__(self, pool): + Group.__init__(self, pool) + + self._columns['users'] = fields.many2many('res.user', + 'res_group_user_rel', 'gid', 'uid', 'Users') Group2() diff --git a/trytond/res/users.xml b/trytond/res/users.xml index ed3a167cb2..7ad281366b 100644 --- a/trytond/res/users.xml +++ b/trytond/res/users.xml @@ -55,20 +55,20 @@ ]]> - + Users - ir.actions.act_window + ir.action.act_window res.user form - tree - form @@ -109,20 +109,20 @@ ]]> - + Groups - ir.actions.act_window + ir.action.act_window res.group form - tree - form @@ -155,33 +155,33 @@ ]]> - + Roles - ir.actions.act_window + ir.action.act_window res.role form - tree - form - + Roles - ir.actions.act_window + ir.action.act_window res.role tree - tree diff --git a/trytond/tools/convert.py b/trytond/tools/convert.py index 82ab87d143..2dbe20b9eb 100644 --- a/trytond/tools/convert.py +++ b/trytond/tools/convert.py @@ -63,13 +63,19 @@ class MenuitemTagHandler: # TODO maybe use a prefetch for this: self.mh.cursor.execute( "SELECT a.name, a.type, v.type, wv.view_mode " \ - "FROM ir_actions a " \ - "LEFT JOIN ir_act_window act on (a.id = act.id) " \ - "LEFT JOIN ir_ui_view v on (v.id = act.view_id) " \ - "LEFT JOIN ir_act_window_view wv on (a.id = wv.act_window_id) " \ - "WHERE a.id = %d " \ + "FROM ir_action a " \ + "LEFT JOIN ir_action_report report ON (a.id = report.action) " \ + "LEFT JOIN ir_action_act_window act ON (a.id = act.action) " \ + "LEFT JOIN ir_action_wizard wizard ON (a.id = wizard.action) " \ + "LEFT JOIN ir_action_url url ON (a.id = url.action) " \ + "LEFT JOIN ir_action_act_window_view wv on (act.id = wv.act_window_id) " \ + "LEFT JOIN ir_ui_view v on (v.id = wv.view_id) " \ + "WHERE report.id = %d " \ + "OR act.id = %d " \ + "OR wizard.id = %d " \ + "OR url.id = %d " \ "ORDER by wv.sequence " \ - "LIMIT 1", (action_id,)) + "LIMIT 1", (action_id, action_id, action_id, action_id)) action_name, action_type, view_type, view_mode = \ self.mh.cursor.fetchone() @@ -78,11 +84,11 @@ class MenuitemTagHandler: icon = attributes.get('icon', '').encode('utf8') if icon: values['icon'] = icon - elif action_type == 'ir.actions.wizard': + elif action_type == 'ir.action.wizard': values['icon'] = 'STOCK_EXECUTE' - elif action_type == 'ir.actions.report': + elif action_type == 'ir.action.report': values['icon'] = 'STOCK_PRINT' - elif action_type == 'ir.actions.act_window': + elif action_type == 'ir.action.act_window': if view_type == 'tree': values['icon'] = 'STOCK_INDENT' elif view_mode and view_mode.startswith('tree'): diff --git a/trytond/trytond.py b/trytond/trytond.py index 97aade5953..6350d76c66 100644 --- a/trytond/trytond.py +++ b/trytond/trytond.py @@ -89,11 +89,6 @@ class TrytonServer(object): "'ir_values', " "'ir_model', " "'ir_model_fields', " - "'ir_actions', " - "'ir_act_window', " - "'ir_act_report', " - "'ir_act_wizard', " - "'ir_act_url', " "'ir_ui_view', " "'ir_ui_menu', " "'res_user', " diff --git a/trytond/web_service/db.py b/trytond/web_service/db.py index 5aa97e8710..897cb7a5ca 100644 --- a/trytond/web_service/db.py +++ b/trytond/web_service/db.py @@ -52,7 +52,6 @@ class DB(Service): 'WHERE login <> \'root\' ORDER BY login') res = cursor.dictfetchall() except Exception, e: - print e logger.notify_channel("web-service", LOG_ERROR, 'CREATE DB: %s failed' % (db_name,)) raise diff --git a/trytond/workflow/workflow.xml b/trytond/workflow/workflow.xml index 8034f28962..da4025ceaa 100644 --- a/trytond/workflow/workflow.xml +++ b/trytond/workflow/workflow.xml @@ -30,19 +30,19 @@ ]]> - + Workflows workflow form - tree - form @@ -110,19 +110,19 @@ ]]> - + Activities workflow.activity form - tree - form @@ -165,19 +165,19 @@ ]]> - + Transitions workflow.transition form - tree - form @@ -216,12 +216,12 @@ ]]> - + Instances workflow.instance form - tree @@ -258,19 +258,19 @@ ]]> - + Workitems workflow.workitem form - tree - form