
Search In
A search_read function is now available. It will do a search and return a list of dict.
In below code i have explain search_read
self.search_read([], ['name'])
[{'id': 3, 'name': u'Administrator'},
{'id': 7, 'name': u'Agrolait'},
{'id': 43, 'name':
Api unity of returned value will return a RecordSet of specified model based on original
returned value:
In below code i have explain api_returns
@api.returns('res.partner')
def afun(self):
...
return x # a RecordSet
Note- And if an old API functi
Api.onchange will trigger the call to the decorated function if any of the fields specified in the decorator is changed in the form:
In below code you can use in your .py file.
@api.onchange('fieldx')
def do_stuff(self):
if self.fieldx == x:
self.fi
When we are using cursor we should use current environment cursor:
like below code.
self.env.cr
except if we need to use threads,we use like below code.
Environment.manage():
env = Environment(cr, uid, context)
Note- Environment.manage() indica
If you want to make print a report in OpenERP(Odoo) follow the below mentioned code and paste it in your model.py file: -
def _get_invoice_id(self, uid, datas):
...
return {’ids’: [...]}
...
’actions’: [_get_invoice_id],
’result’: {’type’:’print’,
In record data is accessible via the read() method, which takes a list of ids (as returned by search()) and optionally a list of fields to fetch.
ids = models.execute_kw(db, uid, password,
'res.partner', 'search',
[[['is_company', '=', True]
In defaults function first we have to go in .py file (python file)
After that we have to decide where we want defaults function and then give attribute defaults function to that field.
See below python code in .py file for reference : -class hr_empl
Odoo directly serves all static files in running modules. This may not be ideal when it comes to performances. And static files should generally be served by a static HTTP server.
Odoo static files live in each module's static/ folder, so static fil
If you want to access old api to new api you have to move on migration method and By default, using new API you have to work on a new RecordSet class instance by yourself. But old context and model are still available in old api. means you have to mo
To modify javascript in Odoo-9 follow the below steps
Go to point of sale module ->static file->src->js->screens.js
For example you can use the below code in screens.js file.
function openerp_pos_screens(instance, module){ //module is i