probably a novice question but here it is.
I need to create a relation on each invoice line to its corresponding sale order line creating a new field on the invoice line form. (Just the same way that delivery out lines are related to sale orders lines). Is it possible to do this easily?.
Thanks in advance.
You already have this:
Look on the sale.order.line model.
invoice_lines: list of invoice lines linked to this sale.order.line
invoiced: if this sale.order.line has been invoiced
You need the reversed one from account.invoice.line ? Add this to your account.invoice.line model (not tested but should works):
'sale_order_lines': fields.many2many('sale.order.line', 'sale_order_line_invoice_rel', 'invoice_id', 'order_line_id', 'Sale Order Lines', readonly=True)
thank you very much for your kind response but this is not exactly what i needed.
I meant one to one relation for each object (invoice_line_id --> sale_order_line_id).
This is what i did (works for me but it's not very neat):
On account_invoice.py (account)
Add column in account_invoice_line:
'sale_order_line_id': fields.many2one('sale.order.line', 'Sales Order Line', help='Sale Order Line'),
On sale.py (sale)
Add column on _prepare_order_line_invoice_line function:
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 11/10/13, 4:35 PM|
|Seen: 3862 times|
|Last updated: 11/15/15, 5:45 AM|