This question has been flagged
1 Reply
3947 Views

I created a custom field "slx_remark" in sale_order_line and the same custom field "slx_remark" in account_invoice_line. Now I would like to send the value from sale_order_line to account_invoice_line during the creation of the invoice.

What is the correct wys to do this in v7?

regards René

Avatar
Discard
Author Best Answer

Found the solution: overwrite the method _prepare_order_line_invoice_line from sale_order_line like the following example:

def myOverriddenMethod(self, cr, uid, line, account_id=False, context=None): res = super(yourobject, self)._prepare_order_line_invoice_line(cr, uid, line, account_id=account_id, context=context) res.update({'your_custom_file_invoice_line': line.sale_line_custom_field}) return res

Avatar
Discard

Hi René. I am trying to do something similar (pass sale.order.line values to account.invoice.line), but no able to do it. Is it possible in Odoo 8.0?

This is my custom module code: from openerp.osv import fields, osv class sale_order_line(osv.osv): _inherit = 'sale.order.line' def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None): res = super(sale_order_line, self)._prepare_order_line_invoice_line(cr, uid, line, account_id=account_id, context=context) res.update({'x_desde': line.x_desde,'x_hasta': line.x_hasta}) return res sale_order_line()