Here is my class and methods. I just wrote for get records and need to print them.but when run openerp in debug mode.its not worked & not go for that method also.& also need to clarify the fetching methods OpenERP 7
class namelistupdate(osv.osv):
def _mytest_query(self, cr, uid, ids, name, args, context=None):
print ('here is demo sql query function result ')
cr.execute("""SELECT module,(id*5000)as result FROM ir_model_data WHERE id=1""")
res = cr.dictfetchall()
print ('here is demo sql query function result ')
print (res)
def _invoiced_rate(self, cr, uid, ids, name, args, context):
self._mytest_query(self, cr, uid, ids, name, args, context)
amount_untaxed = 1
record_id = ids[0]
res = {record_id: 0.0}
if amount_untaxed == 0:
res[record_id] = 100.0
else:
res[record_id] = 50.0
return res
_name = "checkroll.namelist.update"
_description = "This table is for keeping Name list updates"
_columns = {
'date': fields.date("Date"),
'val': fields.function(_invoiced_rate, method=True, type='float', string='Test', store=True),
}
namelistupdate()
error is below
Client Traceback (most recent call last): File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/http.py", line 203, in dispatch response["result"] = method(self, **self.params) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/controllers/main.py", line 1074, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/controllers/main.py", line 1066, in _call_kw return getattr(req.session.model(model), method)(*args, **kwargs) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 43, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 31, in proxy_method result = self.session.send(self.service_name, method, *args) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 104, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info) Server Traceback (most recent call last): File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/web/session.py", line 90, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/netsvc.py", line 293, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/service/web_services.py", line 618, in dispatch res = fn(db, uid, *params) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, *args, **kwargs) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 197, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/orm.py", line 4479, in create self.pool.get(object)._store_set_values(cr, user, ids, fields2, context) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/orm.py", line 4627, in _store_set_values result = self._columns[f].get(cr, self, ids, f, SUPERUSER_ID, context=context) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/fields.py", line 1131, in get result = self._fnct(obj, cr, uid, ids, name, self._arg, context) File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/checkroll/checkroll.py", line 55, in _invoiced_rate self._mytest_query(self, cr, uid, ids, name, args, context) TypeError: _mytest_query() takes exactly 7 arguments (8 given)