简体   繁体   中英

Odoo 10 call old api method

I am using Odoo 10 and trying override stock quants_get_preferred_domain method.

My code:

@api.v7
def quants_get_preferred_domain(self, cr, uid, qty, move, ops=False,  lot_id=False, domain=None, preferred_domain_list=[], context=None):

And I am getting an error:

  File "/opt/odoo10/addons/stock/models/stock_move.py", line 660, in action_assign
    quants = Quant.quants_get_preferred_domain(qty, move, domain=main_domain[move.id], preferred_domain_list=[])
TypeError: quants_get_preferred_domain() takes at least 5 arguments (5 given)

What can be wring with decorators and how correctly on v10 can I call old api method?

Seems that you are changing the method decorator definition from @api.model to @api.v7

You could check that in the code of the method quants_get_preferred_domain . You should be ok defining the method override as:

@api.model
def quants_get_preferred_domain(self, qty, move, ops=False, lot_id=False, domain=None, preferred_domain_list=[]):

You should also check if your Odoo version is outdated that may have some issues solved in earlier Odoo 10 versions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM