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

Calling onchange product_id_change() method

By
John Doe
on 6/24/16, 3:59 AM 357 views

Hello,
I'm trying to call a product_id_change method becouse i'd like to change the currency in every sale order line by changing date_order.  By using below code i'm getting an error : product_id_change() takes at least 6 arguments (5 given). Which arguments should i use?

 

@api.onchange('date_order')
def change_currency_rate(self):
     for line in self.order_line:
         line.product_id_change()


product_id_change() takes at least 6 arguments (6 given)

?!?!?!! Odooooo whyyyyyyy

John Doe
on 6/24/16, 7:31 AM
0
kirubanidhi
On 6/24/16, 7:12 AM
Try to use this code
@api.onchange('date_order')
def change_currency_rate(self):    
    for line in self.order_line:  
    val=product_id_change(line)

def product_id_change(self,line):
----code

product_id_change() takes at least 6 arguments (6 given)

?!?!?!! Odooooo whyyyyyyy

John Doe
on 6/24/16, 7:31 AM
0
John Doe
On 6/24/16, 7:07 AM

I know that i have to this but i don't know which of these arguments i have to pass. This is def i want to call:

def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):

 I'm using models.Model in version 8


0
Krupesh Laiya
On 6/24/16, 6:17 AM

You have to pass the parameter to the product_id_change function 

data = line.product_id_change(self._cr, self._uid, [], pricelist, product, qty, uom, qty_uos, uos,name,partner_id,lang, update_tax, date_order, packaging, fiscal_position, flag, context=self._context)

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/24/16, 3:59 AM
Seen: 357 times
Last updated: 6/24/16, 7:12 AM