Odoo Help

Welcome!

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.

0

can't override a function

By
hajar el hamdani
on 6/23/16, 8:22 AM 232 views

hello everybody,

i want to override this function, to make changes, but its not considered, here it is the function


def _get_invoice_line_vals(self, cr, uid, move, partner, inv_type, context=None):

       res = super(stock_move, self)._get_invoice_line_vals(cr, uid, move, partner, inv_type, context=context)

       if inv_type == 'in_invoice' and move.purchase_line_id:

       purchase_line = move.purchase_line_id

       res['invoice_line_tax_id'] = [(6, 0, [x.id for x in purchase_line.taxes_id])]

       res['price_unit'] = purchase_line.price_unit

       elif inv_type == 'in_refund' and move.origin_returned_move_id.purchase_line_id:

       purchase_line = move.origin_returned_move_id.purchase_line_id

       res['invoice_line_tax_id'] = [(6, 0, [x.id for x in purchase_line.taxes_id])]

       res['price_unit'] = purchase_line.price_unit

       return res

its already overridden in diffrent places, i did the same thing in my class but it didnt work

1
Krupesh Laiya
On 6/24/16, 2:04 AM

- put stock module in depends of your module

- take copy of that function field from base file and put it in your file.

- update the module and refresh the view

Hope this will solve your problem.

thank you that's solved my problem

hajar el hamdani
on 6/24/16, 6:31 AM

welcome and all the best.

Krupesh Laiya
on 6/27/16, 1:33 AM

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)

Stats

Asked: 6/23/16, 8:22 AM
Seen: 232 times
Last updated: 6/24/16, 6:32 AM