Skip to content

Commit

Permalink
[FIX] fields property: do not create empty properties
Browse files Browse the repository at this point in the history
fixes odoo#595
In the case where a property for the company exists but has no related record (e.g. in case of type m2o with no defined value), not setting a value to this field for a new record would create a new property (as browse_null is not an instance of browse_record)
  • Loading branch information
gurneyalex authored and mart-e committed Jun 25, 2014
1 parent 50871bb commit 4bfcbb2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openerp/osv/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,8 @@ def _fnct_write(self, obj, cr, uid, id, prop_name, id_val, obj_dest, context=Non
default_val = self._get_default(obj, cr, uid, prop_name, context)

property_create = False
if isinstance(default_val, openerp.osv.orm.browse_record):
if isinstance(default_val, (openerp.osv.orm.browse_record,
openerp.osv.orm.browse_null)):
if default_val.id != id_val:
property_create = True
elif default_val != id_val:
Expand Down

0 comments on commit 4bfcbb2

Please sign in to comment.