From 70890bfa3250e33769e12a818780f90b3889be63 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Wed, 16 Jan 2013 18:14:54 +0100 Subject: [PATCH] [WIP] introduce a way to reference specific config options bzr revid: abo@openerp.com-20130116171454-s4tt2f6le80oruc0 --- openerp/addons/base/res/res_config.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py index a3b168a8d82..f7085f44000 100644 --- a/openerp/addons/base/res/res_config.py +++ b/openerp/addons/base/res/res_config.py @@ -25,6 +25,7 @@ from openerp import pooler from openerp.osv import osv, fields from openerp.tools import ustr from openerp.tools.translate import _ +from openerp.addons.base.ir.ir_ui_menu import MENU_ITEM_SEPARATOR _logger = logging.getLogger(__name__) @@ -588,22 +589,24 @@ class res_config_settings(osv.osv_memory): name = act_window.read(cr, uid, action_ids[0], ['name'], context=context)['name'] return [(record.id, name) for record in self.browse(cr, uid , ids, context=context)] - def get_path(self, cr, uid, module_name, menu_xml_id=None, field_name=None, context=None): + def get_config_path(self, cr, uid, module_name, menu_xml_id=None, model_name=None, field_name=None, context=None): """ Return a string representing the path to access a specific configuration option through the interface. + + :return string """ config_path = '' # Fetch the path - if (menu_xml_id): + if (module_name and menu_xml_id): dummy, menu_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module_name, menu_xml_id) - config_path += self.pool.get('ir.ui.menu').browse(cr, uid, menu_id, context=context).name + config_path += self.pool.get('ir.ui.menu').browse(cr, uid, menu_id, context=context).complete_name # Fetch the exact config option name - #if (field_name): - # self.pool.get('mycfgobj')._get_all_columns().strings[field_name] + if (model_name and field_name): + config_path += MENU_ITEM_SEPARATOR + self.pool.get(model_name)._all_columns.get(field_name).column.string return config_path