Skip to Content
Menu
This question has been flagged
1 Reply
1739 Views

I have a rental_qty field (float) that exists in my sale.order.line which I use in the sale.order.form and I'd like to have its value shown on my account.invoice.form as well. But the field doesn't exist in the account.invoice.line model so it gives me an error "Field 'rental_qty' does not exist." What can I do to have them linked?

Avatar
Discard

See you have a relation from account.invoice.line to sale.order.line , ie sale_line_ids

Hope the below sample code helps !!

class AccountInvoice(models.Model):
    _inherit = 'account.invoice'

    @api.multi def your_function(self):          for invoice in self: for line in invoice.invoice_line_ids: for sale_line in line.sale_line_ids: rental_qty = sale_line.rental_qty