[IMP] res.config.settings: re-enable automatic execute upon save

bzr revid: rco@openerp.com-20120327113820-pfsdbwh8cm7irhwu
This commit is contained in:
Raphael Collet 2012-03-27 13:38:20 +02:00
parent 39a3c3ebd9
commit c7663a1f9b
1 changed files with 15 additions and 1 deletions

View File

@ -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,19 @@ 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 copy(self, cr, uid, id, values, context=None):
raise osv.except_osv(_("Cannot duplicate configuration!"), "")
def _get_classified_fields(self, cr, uid, context=None):
""" return a dictionary with the fields classified by category::