From b2bb03ba4a26807cee969c238639e60faced138e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 16 Apr 2013 15:48:47 +0200 Subject: [PATCH] [FIX] correct actions bzr revid: mat@openerp.com-20130416134847-celf4nbl7748vnj5 --- addons/gamification/goal.py | 23 +++++++------------ .../static/src/js/gamification.js | 2 +- addons/hr/hr.py | 2 -- addons/hr/res_config.py | 4 ++-- addons/hr_gamification/__openerp__.py | 1 - 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 444970bf3e7..f9a9cb93620 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -357,21 +357,9 @@ class gamification_goal(osv.Model): In case of a manual goal, should return a wizard to update the value :return: action description in a dictionnary """ - print("get_action") goal = self.browse(cr, uid, goal_id, context=context) if goal.type_id.action_id: - action_obj = goal.type_id.action_id - action = { - 'name': action_obj.name, - 'view_type': action_obj.view_type, - 'view_mode': action_obj.view_mode, - 'res_model': action_obj.res_model, - 'domain': action_obj.domain, - 'context': action_obj.context, - 'type': 'ir.actions.act_window', - 'search_view_id': action_obj.search_view_id.id, - 'views': [(v.view_id.id, v.view_mode) for v in action_obj.view_ids] - } + action = goal.type_id.action_id.read()[0] if goal.type_id.res_id_field: current_user = self.pool.get('res.users').browse(cr, uid, uid, context) @@ -381,9 +369,14 @@ class gamification_goal(osv.Model): for field_name in field_names[1:]: res = res.__getitem__(field_name) action['res_id'] = res - action['view_mode'] = 'form' # if one element to display, should see it in form mode + + # if one element to display, should see it in form mode if possible + views = action['views'] + for (view_id, mode) in action['views']: + if mode == "form": + views = [(view_id, mode)] + action['views'] = views action['target'] = 'new' - print(action) return action if goal.computation_mode == 'manually': diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 7f1e31d2c24..e68874c866b 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -155,7 +155,7 @@ openerp.gamification = function(instance) { "#ff0000", "#f9c802", "#a9d70b" - ], + ] }); } }); diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 176205d87b2..467f34f708b 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -23,8 +23,6 @@ from openerp import addons import logging from openerp.osv import fields, osv from openerp import tools -from openerp.tools.translate import _ - _logger = logging.getLogger(__name__) class hr_employee_category(osv.osv): diff --git a/addons/hr/res_config.py b/addons/hr/res_config.py index 2eec37726e2..94c029262ff 100644 --- a/addons/hr/res_config.py +++ b/addons/hr/res_config.py @@ -40,9 +40,9 @@ class hr_config_settings(osv.osv_memory): help ="""This installs the module hr_recruitment."""), 'module_hr_contract': fields.boolean('Record contracts per employee', help ="""This installs the module hr_contract."""), - 'module_hr_evaluation': fields.boolean('Organize employees periodic evaluation and goals', + 'module_hr_evaluation': fields.boolean('Organize employees periodic evaluation', help ="""This installs the module hr_evaluation."""), - 'module_hr_gamification': fields.boolean('Manage badges', + 'module_hr_gamification': fields.boolean('Drive engagement with challenges and badges', help ="""This installs the module hr_gamification."""), 'module_account_analytic_analysis': fields.boolean('Allow invoicing based on timesheets (the sale application will be installed)', help ="""This installs the module account_analytic_analysis, which will install sales management too."""), diff --git a/addons/hr_gamification/__openerp__.py b/addons/hr_gamification/__openerp__.py index 9b7be7b3ea0..ed7a18dd3e9 100644 --- a/addons/hr_gamification/__openerp__.py +++ b/addons/hr_gamification/__openerp__.py @@ -34,6 +34,5 @@ Badge received are displayed on the user profile. 'security/ir.model.access.csv', 'gamification_view.xml', ], - 'auto_install': True, 'js': ['static/src/js/gamification.js'], }