summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorXavier ALT <xal@odoo.com>2016-05-30 12:15:06 +0200
committerRaphael Collet <rco@openerp.com>2016-06-17 17:50:25 +0200
commitf02b23006b63c375258cf5a33c903318e59e7bbb (patch)
tree57ca70be281d7281b872e8b915ceb83b958901d1 /doc/reference
parentbcb191f273bae8ed99c17843658789a44f6e5bfc (diff)
[FIX] fields: during an onchange(), do not invalidate *2many fields because of their domain
Our usage of domain on fields One2many seems to trigger an obscure behaviour on onchange. With the following (simplified) config: Message(models.Model): _name = 'test_new_api.message' important = fields.Boolean('Important') Discussion(models.Model): _name = 'test_new_api.discussion' name = fields.Char('Name') important_emails = fields.One2Many('test_new_api.emailmessage', 'discussion', domain=[('important', '=', True)]) Email(models.Model): _name = 'test_new_api.emailmessage' _inherits = {'test_new_api.message': 'message'} discussion = fields.Many2one('test_new_api.discussion', 'Discussion') message = fields.Many2one('test_new_api.message', 'Message') Steps: - We change 'name' on discussion, triggers an `onchange()` call - we ends up filling cache on virtual record (on secondary fields, we calling record.mapped('important_emails.important')) - we get a cache miss ('important' field not provided, only 'important_emails' ids, i.e with no change on existing records) - we fill the cache, this mark 'important' field as modified - because of commit 5676d81 and because 'important' is that case is a related (i.e computed) field we triggers cache recomputation - as there is no way to recompute 'important_emails' for virtual record (no real ID) we ends up with empty 'important_emails' generating removal of existing records. => Finally changing any value for 'test_new_api.discussion' that trigger an onchange will always reset 'important_emails' to empty Fixed by Raphael Collet <rco@odoo.com>, and test by Xavier Alt <xal@odoo.com>.
Diffstat (limited to 'doc/reference')
0 files changed, 0 insertions, 0 deletions