0

How to pass new field value from sale order line to invoice lines while using down payment in odoo 15

1 Answers1

0

Usefull basics:

The model sale.order.line is related to the model account.move.line through this field:

invoice_lines: list of invoice lines (account.move.line) linked to this sale.order.line

And the corresponding relational field in account.move.line to sale.order.line is:

sale_line_ids: list of sale order lines (sale.order.line) linked to this account.move.line

1. Create a new field

To create a new field in the model you want: (App) Configuration > (Menu) Technicals > Fields Create new field in the model you want (account.invoice.line ?) Example : mynewfield

2. Create an automated Action

Create an automated action using (App) Configuration > (Menu) Technicals > automated Actions Or: can be found here : /web?debug=1#id=&action=435&model=base.automation) Create a new one, on the model sale.order.line Action: execute python code

        #Update invoice lines corresponding to the current sale.order.line-record:
        for invoice_line_record in record.invoice_lines:
           invoice_line_record['mynewfield'] = record['invoiced']
sylvain
  • 853
  • 1
  • 7
  • 20