diff --git a/trytond/ir/actions.py b/trytond/ir/actions.py index 49323cace6..912282e79c 100644 --- a/trytond/ir/actions.py +++ b/trytond/ir/actions.py @@ -39,6 +39,7 @@ class ActionKeyword(OSV): 'keyword': fields.Selection([ ('tree_open', 'Open tree'), ('tree_action', 'Action tree'), + ('form_print', 'Print form'), ('form_action', 'Action form'), ('form_relate', 'Form relate'), ], string='Keyword', required=True), @@ -51,10 +52,12 @@ class ActionKeyword(OSV): res = [] model, model_id = value - action_keyword_ids = self.search(cursor, user, [ - ('keyword', '=', keyword), - ('model', '=', model + ',' + str(model_id)), - ], context=context) + action_keyword_ids = [] + if model_id: + action_keyword_ids = self.search(cursor, user, [ + ('keyword', '=', keyword), + ('model', '=', model + ',' + str(model_id)), + ], context=context) action_keyword_ids.extend(self.search(cursor, user, [ ('keyword', '=', keyword), ('model', '=', model + ',0'), @@ -64,6 +67,9 @@ class ActionKeyword(OSV): 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_odt_content_data'] + del res[-1]['report_odt_content'] return res ActionKeyword() diff --git a/trytond/ir/module/module.xml b/trytond/ir/module/module.xml index 36105a1445..9149e6aed1 100644 --- a/trytond/ir/module/module.xml +++ b/trytond/ir/module/module.xml @@ -134,6 +134,11 @@ Install / Upgrade Modules ir.module.module.install_upgrade + + + form_action + ir.module.module,0 + ir.module.module.install_upgrade.init form diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index b1e93fe1b1..9dea5f22fe 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -1754,41 +1754,17 @@ class ORM(object): result['arch'] = xarch result['fields'] = xfields if toolbar: - - def clean(i): - i = i[2] - for key in ( - 'report_sxw_content', - 'report_rml_content', - 'report_sxw', 'report_rml', - 'report_sxw_content_data', - 'report_rml_content_data', - ): - if key in i: - del i[key] - return i - - ir_values_obj = self.pool.get('ir.values') - resprint = ir_values_obj.get(cursor, user, 'action', - 'client_print_multi', [(self._name, False)], False, - context) - resaction = ir_values_obj.get(cursor, user, 'action', - 'client_action_multi', [(self._name, False)], False, - context) - resrelate = ir_values_obj.get(cursor, user, 'action', - 'client_action_relate', [(self._name, False)], False, - context) - resprint = [clean(x) for x in resprint] - resaction = [clean(x) for x in resaction] - resaction = [x for x in resaction if not x.get('multi', False)] - resprint = [x for x in resprint if not x.get('multi', False)] - resrelate = [x[2] for x in resrelate] - for i in resprint + resaction + resrelate: - i['string'] = i['name'] + action_obj = self.pool.get('ir.action.keyword') + prints = action_obj.get_keyword(cursor, user, 'form_print', + (self._name, 0), context=context) + actions = action_obj.get_keyword(cursor, user, 'form_action', + (self._name, 0), context=context) + relates = action_obj.get_keyword(cursor, user, 'form_relate', + (self._name, 0), context=context) result['toolbar'] = { - 'print': resprint, - 'action': resaction, - 'relate': resrelate, + 'print': prints, + 'action': actions, + 'relate': relates, } result['md5'] = md5.new(str(result)).hexdigest() if hexmd5 == result['md5']: