I am trying to create button in Invoice that will update certain field in inovoice lines. I've found how to update field in account.invoice but I am strugling to find right way how to update it in account.invoice.line.
class accountinvoiceext(models.Model):
_inherit = ['account.invoice']
@api.one
def my_button(self,uid):
invoice_id = self.id
#lines = getinvoicelinesbyid(invoice_id)
I am sure there is some proper way how to get invoice.lines related to this invoice, or not ? I've tried _inherit account.invoice.line but then I cannot define button there.
Second question - what is best way to call some function every time invoice is created ?