Skip to Content
Menú
This question has been flagged
3 Respostes
6133 Vistes

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


Avatar
Descartar
Autor

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

?!?!?!! Odooooo whyyyyyyy

Best Answer
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

Avatar
Descartar
Autor

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

?!?!?!! Odooooo whyyyyyyy

Autor Best Answer

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


Avatar
Descartar
Best Answer

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)

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de set. 24
1125
0
de set. 21
3272
0
d’oct. 18
3174
1
de gen. 23
6668
1
de juny 22
2709