Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to pass a custom-field-value from sale_order_line to account_invoice_line ?

on 7/16/13, 12:17 PM 1,034 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é

On 7/17/13, 10:49 AM

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

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?

on 11/24/14, 3:05 PM

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()

on 11/24/14, 3:36 PM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 7/16/13, 12:17 PM
Seen: 1034 times
Last updated: 3/16/15, 8:10 AM