From ced4e19e87b342dc9b97aa42734a48bdfc33468d Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 23 Mar 2012 09:35:21 +0100 Subject: [PATCH] [IMP] res.config.settings: apply changes upon create/write bzr revid: rco@openerp.com-20120323083521-n1srgpn9042s9cli --- openerp/addons/base/res/res_config.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py index cff43d74376..f3226acbe3b 100644 --- a/openerp/addons/base/res/res_config.py +++ b/openerp/addons/base/res/res_config.py @@ -413,7 +413,8 @@ class res_config_settings(osv.osv_memory): 'other_field': fields.type(...), } - The method ``execute`` provides some support based on a naming convention: + The method ``execute`` is automatically called after creating and writing on records. + It provides some support based on a naming convention: * For a field like 'default_XXX', ``execute`` sets the (global) default value of the field 'XXX' in the model named by ``default_model`` to the field's value. @@ -437,6 +438,16 @@ class res_config_settings(osv.osv_memory): _name = 'res.config.settings' _inherit = 'res.config' + def create(self, cr, uid, values, context=None): + id = super(res_config_settings, self).create(cr, uid, values, context) + self.execute(cr, uid, [id], context) + return id + + def write(self, cr, uid, ids, values, context=None): + res = super(res_config_settings, self).write(cr, uid, ids, values, context) + self.execute(cr, uid, ids, context) + return res + def _get_classified_fields(self, cr, uid, context=None): """ return a dictionary with the fields classified by category::