I just want to know, how can some functions be translated into the new API, or if there is need to fully translate them, depending on what api call are we using.
For example,
@api.model
the method is exposed as not using ids, its recordset will generally be empty. Its "old API" signature is cr, uid, *arguments, context:
@api.model
def some_method(self, a_value):
pass
# can be called as
old_style_model.some_method(cr, uid, a_value, context=context)
On Odoo v8, suppose I have this kind of function:
def update_info(self, cr, uid, ids, context=None):
""" OpenERP osv memory wizard : update_info_partner
"""
context = context or {}
seniat_url_obj = self.env('seniat.url')
self.cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''')
record = self.cr.fetchall()
pids = [item[0] for item in record]
seniat_url_obj.connect_seniat(cr, uid, pids, context=context,
all_rif=True)
return{}
If I add @api.model decorator to this function, I guess I also need to update the attributes of it, ie: self, cr, uid, ids, context=None, right?
In this case, it is sufficient, to add @api.model decorator and then change the function attributes to only self?
I'm just trying to get how to work this out, from now on, since I'm mirgating some modules from v8 to v10.