Community mailing list archives

community@mail.odoo.com

Mirror one2many field between models

by
Ryan Cole
- 11/04/2016 08:34:38
Hello Community!



I have two custom models voucher and voucher_collection, and one extended model pos_order. I've also added a custom field to the pos_order form view, using the related field on the order model. You can see my pseudo-python here


My problem is this:

When the user adds a voucher to pos_order.voucher_ids, it causes pos_order.voucher_collection.voucher_ids to update too.

However, when updating voucher_collection.voucher_ids directly, pos_order.voucher_ids remains unchanged.


It seems that the related field is only updating in one direction - any changes made on the other side are not reflected. Is this by design, or am I using the field incorrectly? Does anyone have a suggestion for another method to mirror/link one2many fields between models like this?



Kind regards,
Ryan Cole