One2Many based on a function m2o

Similar to this I have another issue, in this case the structure looks as follows:


records = fields.One2Many(‘record’, ‘party’, ‘Records’, readonly=True)

However, in record model, party is defined as a function field with searcher (but no setter). Something like:

party = fields.Function(fields.Many2One(‘’, ‘Party’), ‘get_party’, searcher=‘search_party’)

In this case, when the user changes any record of the o2m field, the error it raises is that the party field of record has no setter.

I find it strange that Tryton tries to call the setter on party field.

I have the impression that it may be due to the way sao is sending the data to trytond. This is the log on the server:

<class ‘’>.write(*([18387], {‘records’: [[‘add’, [46954]], [‘write’, [46954], {‘another_field’: 47034}]]}, …)

It seems that sao is sending an “add” operation even though the record was actually not added, only an existing record was modified, so only write should be sent, isn’t it?

Is this a bug?

No it is the expected behavior. The client can not assume that a modified record of a One2Many is still added so it must ensure that.
But it should not be a problem with Issue 9194: Do not write on target already added to One2Many - Tryton issue tracker