Community mailing list archives

Re: Accessing Delivery from Invoice Line in v9

Pedro M. Baeza
- 05/16/2016 06:43:15

2016-05-15 23:38 GMT+02:00 Harry Jollenbeck <>:
Hi all,

I am working on a project which requires showing lot numbers on generated invoices (in the invoice table as an additional column), as chosen in the related delivery order.

Now, in v9 as far as I can tell there is no direct relationship between an invoice and a delivery, so my first idea was to transverse through the below relations to retrieve the related lot numbers in a computed field on invoice_line:
Invoice_line -> sale_order_line -> (using procurement group) -> stock_move -> stock_pack_operation -> stock_pack_operation_lot

But this presents some problems. What if there are multiple deliveries, or more difficult- multiple invoices for a single sales order?

My next idea, is to add a lot_id field on sale_order_line and record the lot number here at the time the delivery is completed. I guess this would happen at the same time the qty_deliveried field is updated. Then the lot number could be either accessed in the invoice through the sale_order_line_invoice_rel relationship, or could be stored as an additional field in the invoice_line model when generating the invoice from the sale order.

I wonder if any of you clever ones have had to implement something similar before? And what you think of my implementation ideas?

Thank you,

Post to: