Dear community,
I'm trying to add register when i change the state of the invoice, the draft to posted.
I think that i have to catch the write event and the vals but i can't understand, how can i filter the vals for every register.
Example code :
@api.model def write(self, vals): for invoice in self: if (vals.get('state') == 'posted'): pos_id = invoice.line_ids.sale_line_ids.order_id.astore_tpv_id invoice_date = invoice.invoice_date amount_total = invoice.amount_total account_move_id = invoice.id
Kind regards