Can someone help me to create a function for total invoice? This is my first test
@api.one
@api.onchange('facture_ids.total_a_payer')
def _invoice_total(self):
if self.facture_ids.type=="npay":
self.total_invoiced = sum(line.facture_ids.total_a_payer
for record in self.browse())
You can simple change in @api.one to @api.multi because of @api.one is ony give a record but @api.multi is give a list of recorded set
and you function give a list of recorded set that's way you use the @api.multi and you can sum of more than one invoice