There's an example in account.invoice where the fields amount_untaxed, amount_tax and amount_total are computed by the same function, _amount_all. An shortened example:
'amount_total': fields.function(_amount_all, method=True, digits=(16,2), string='Total',This means that if an account.invoice.line changes, _get_invoice_line is invoked with the line's id. _get_invoice_line has to return an id of the main object, account.invoice. _amount_all will receive that id and compute the value to be stored in the field.
store={
'account.invoice.line': (_get_invoice_line, None, 20),
},),
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.