diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index b36fc27d9d3..cb8440ddb49 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -24,6 +24,8 @@ import logging import operator import os import time +import datetime +import dateutil import openerp from openerp import SUPERUSER_ID @@ -268,7 +270,7 @@ class ir_actions_act_window(osv.osv): 'filter': fields.boolean('Filter'), 'auto_search':fields.boolean('Auto Search'), 'search_view' : fields.function(_search_view, type='text', string='Search View'), - 'multi': fields.boolean('Action on Multiple Doc.', help="If set to true, the action will not be displayed on the right toolbar of a form view"), + 'multi': fields.boolean('Restrict to lists', help="If checked and the action is bound to a model, it will only appear in the More menu on list views"), } _defaults = { @@ -928,11 +930,18 @@ class ir_actions_server(osv.osv): 'obj': obj, 'pool': self.pool, 'time': time, + 'datetime': datetime, + 'dateutil': dateutil, 'cr': cr, 'uid': uid, 'user': user, + 'context': context, } + } + return eval_context + + def run(self, cr, uid, ids, context=None): """ Runs the server action. For each server action, the condition is checked. Note that a void (``False``) condition is considered as always @@ -955,7 +964,6 @@ class ir_actions_server(osv.osv): if context is None: context = {} res = False - active_ids = context.get('active_ids', [context.get('active_id')]) for action in self.browse(cr, uid, ids, context): eval_context = self._get_eval_context(cr, uid, action, context=context) condition = action.condition @@ -963,9 +971,7 @@ class ir_actions_server(osv.osv): # Void (aka False) conditions are considered as True condition = True if hasattr(self, 'run_action_%s_multi' % action.state): - # set active_ids in context only needed if one active_id - run_context = dict(context, active_ids=active_ids) - eval_context["context"] = run_context + run_context = eval_context['context'] expr = eval(str(condition), eval_context) if not expr: continue @@ -975,6 +981,8 @@ class ir_actions_server(osv.osv): elif hasattr(self, 'run_action_%s' % action.state): func = getattr(self, 'run_action_%s' % action.state) + active_id = context.get('active_id') + active_ids = context.get('active_ids', [active_id] if active_id else []) for active_id in active_ids: # run context dedicated to a particular active_id run_context = dict(context, active_ids=[active_id], active_id=active_id) diff --git a/openerp/addons/base/ir/ir_actions.xml b/openerp/addons/base/ir/ir_actions.xml index 7e6c1f9be4b..7ac0252da80 100644 --- a/openerp/addons/base/ir/ir_actions.xml +++ b/openerp/addons/base/ir/ir_actions.xml @@ -180,6 +180,7 @@ + diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index fe62d9e80cc..aafce29b7eb 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -755,6 +755,10 @@ class view(osv.osv): # running index by tag type, for XPath query generation indexes = collections.defaultdict(lambda: 0) for child in e.iterchildren(tag=etree.Element): + if child.get('data-oe-xpath'): + # injected by view inheritance, skip otherwise + # generated xpath is incorrect + continue indexes[child.tag] += 1 self.distribute_branding(child, distributed_branding, parent_xpath=node_path, diff --git a/openerp/addons/base/ir/ir_values.py b/openerp/addons/base/ir/ir_values.py index a21b034d1b0..6af09b7ecbb 100644 --- a/openerp/addons/base/ir/ir_values.py +++ b/openerp/addons/base/ir/ir_values.py @@ -394,17 +394,16 @@ class ir_values(osv.osv): for action in cr.dictfetchall(): if not action['value']: continue # skip if undefined - action_model,id = action['value'].split(',') - fields = [ - field - for field in self.pool[action_model]._all_columns - if field not in EXCLUDED_FIELDS] + action_model_name, action_id = action['value'].split(',') + action_model = self.pool.get(action_model_name) + if not action_model: + continue # unknow model? skip it + fields = [field for field in action_model._all_columns if field not in EXCLUDED_FIELDS] # FIXME: needs cleanup try: - action_def = self.pool[action_model].read(cr, uid, int(id), fields, context) + action_def = action_model.read(cr, uid, int(action_id), fields, context) if action_def: - if action_model in ('ir.actions.report.xml','ir.actions.act_window', - 'ir.actions.wizard'): + if action_model_name in ('ir.actions.report.xml', 'ir.actions.act_window'): groups = action_def.get('groups_id') if groups: cr.execute('SELECT 1 FROM res_groups_users_rel WHERE gid IN %s AND uid=%s', diff --git a/openerp/addons/base/res/res_company.py b/openerp/addons/base/res/res_company.py index dfe049bf2b3..ae83aa4f2d1 100644 --- a/openerp/addons/base/res/res_company.py +++ b/openerp/addons/base/res/res_company.py @@ -124,7 +124,8 @@ class res_company(osv.osv): 'rml_footer': fields.text('Report Footer', help="Footer text displayed at the bottom of all reports."), 'rml_footer_readonly': fields.related('rml_footer', type='text', string='Report Footer', readonly=True), 'custom_footer': fields.boolean('Custom Footer', help="Check this to define the report footer manually. Otherwise it will be filled in automatically."), - 'font': fields.many2one('res.font', string="Font",help="Set the font into the report header, it will be used as default font in the RML reports of the user company"), + 'font': fields.many2one('res.font', string="Font", domain=[('mode', 'in', ('Normal', 'Regular', 'all', 'Book'))], + help="Set the font into the report header, it will be used as default font in the RML reports of the user company"), 'logo': fields.related('partner_id', 'image', string="Logo", type="binary"), 'logo_web': fields.function(_get_logo_web, string="Logo Web", type="binary", store={ 'res.company': (lambda s, c, u, i, x: i, ['partner_id'], 10), diff --git a/openerp/addons/base/res/res_company_view.xml b/openerp/addons/base/res/res_company_view.xml index 7a146f6bc5e..5139623031f 100644 --- a/openerp/addons/base/res/res_company_view.xml +++ b/openerp/addons/base/res/res_company_view.xml @@ -93,7 +93,7 @@