Add toolbar to view
This commit is contained in:
+10
-4
@@ -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()
|
||||
|
||||
@@ -134,6 +134,11 @@
|
||||
<field name="name">Install / Upgrade Modules</field>
|
||||
<field name="wiz_name">ir.module.module.install_upgrade</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="act_module_install_upgrade_keyword1">
|
||||
<field name="action" ref="act_module_install_upgrade"/>
|
||||
<field name="keyword">form_action</field>
|
||||
<field name="model">ir.module.module,0</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="module_install_upgrade_init_view_form">
|
||||
<field name="model">ir.module.module.install_upgrade.init</field>
|
||||
<field name="type">form</field>
|
||||
|
||||
+10
-34
@@ -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']:
|
||||
|
||||
Reference in New Issue
Block a user