0

I want to have a field in the invoice line that will show the price that is product getting from product.pricelist. Can I make a related field? or do I need to do it another way?

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

    price_by_pricelist = fields.Float(related="???", "Price by Pricelist")

UPDATE

actually, I need to add this field to vendor bills but I think it's not changing anything here

Basically, I want to compare price from price list and actual product price in vendor bills line

KbiR
  • 4,047
  • 6
  • 37
  • 103
Chaban33
  • 1,362
  • 11
  • 38
  • Actually in invoices there is nothing you can relate on. Problem begins on the non exisiting pricelist on the invoice, on which base the price would be computed. – CZoellner Jul 04 '18 at 10:00
  • any solutions for my problem? – Chaban33 Jul 04 '18 at 11:15
  • The invoice lines are usually created from purchase or sale lines. Find the right method and extend it by passing the purchase or sale line price to an extra field on the invoice line. A related field is not possible. – CZoellner Jul 04 '18 at 11:31
  • For odoo v9 look into `def _prepare_invoice_line_from_po_line() ` – CZoellner Jul 04 '18 at 11:34

0 Answers0