I'm trying to write 'quantity' or 'price_unit' in invoice_line_ids but it don's work
def process_invoice(self):
self = self.with_user(SUPERUSER_ID)
order_ids = self.order_ids.filtered(lambda order: order.state == 'draft')
for order in order_ids:
order.action_confirm()
moves = order._create_invoices(final=False)
for move in moves:
new_quantity = 1
new_price_unit = 200
for line in move.line_ids:
line.write({
'quantity': new_quantity,
'price_unit': new_price_unit
})
I think I need to use _get_price_total_and_subtotal() and _get_fields_onchange_balance() functions but how to do it?
THANKS
I see you are write the field 'line_ids' how about change to 'invoice_line_ids' ?