4
for line in invoice.invoice_line_ids:
        if line.sale_line_ids:
            if line.sale_line_ids.qty_avl_stock >= line.sale_line_ids.product_uom_qty:
                        term = _('At warehouse')

in a proforma invoice, I want to check sale_order_line fields that is related to invoice_line.

In account.invoice.line I found a relation to sale.order.line it's sale_line_ids field. my goal is to make some checking in related sale_order_line but is this a good way to do? or maybe I should do a search on sale.order.line model? Because sale_line_ids field is many2many and probably there can be more than one record and if that is the case i will get an error here.

UPDATE for bounty

Basically, I need check order_line qty_avl_stock and product_uom_qantity that is related to invoice_line. But I don't know how is the best way to relate sale_order_line to invoice_line, or maybe there are other solutions?

class SaleOrerLine(self)

 qty_avl_stock = fields.float("Quantity availible stock")
Chaban33
  • 1,362
  • 11
  • 38

0 Answers0