[FIX] website: config settings does write the values on the website model

This config contains only related fields of the website_id many2one.
The problem is that applying the change CREATE a res config settings
And the create orm method does not forward and write the values on the related fields.
Write does.
The best fix should be to change all these related fields to char fields, 
and to create the set_ method who will acutally set the value to the website_id.
But, unfortunately, this is a stable branch
And we cannot alter the database structure in stable branches.

bzr revid: dle@openerp.com-20140207172157-6upyhuin93qlkrfa
This commit is contained in:
Denis Ledoux
2014-02-07 18:21:57 +01:00
parent efe1e4a183
commit 38b7c38e32
+8
View File
@@ -29,6 +29,14 @@ class website_config_settings(osv.osv_memory):
values[fname] = v[0] if v and self._columns[fname]._type == 'many2one' else v
return {'value' : values}
# FIXME in trunk for god sake. Change the fields above to fields.char instead of fields.related,
# and create the function set_website who will set the value on the website_id
# create does not forward the values to the related many2one. Write does.
def create(self, cr, uid, vals, context=None):
config_id = super(website_config_settings, self).create(cr, uid, vals, context=context)
self.write(cr, uid, config_id, vals, context=context)
return config_id
_defaults = {
'website_id': lambda self,cr,uid,c: self.pool.get('website').search(cr, uid, [], context=c)[0],
}