How to write an on_change that modifies a field inside a o2m field?

Asked by Leonardo Pistone on 2011-05-31

Hi all.

I'd like to have an on_change of a field to change a field inside a o2m field. It's not clear to me how to write the result['value'] in that case.

Practical example:

take the invoice view as it is now in v6. Suppose I wanted to improve the fiscal_position field, adding an on_change to it that re-computes the taxes inside the invoice lines. It's not clear to me what the on_change function should return in that case

Any pointers?


Question information

English Edit question
Odoo Server (MOVED TO GITHUB) Edit question
No assignee Edit question
Last query:
Last reply:
Graeme Gellatly (gdgellatly) said : #1


I wrote an onchange doing just that for account_account_extension_o4sb released last week. The function signature is this one

def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None):

and it starts on line 71 of

but basically all you do is return a list of dictionaries for that field value.

Can you help with this problem?

Provide an answer of your own, or ask Leonardo Pistone for more information if necessary.

To post a message you must log in.