更改部门时,我需要将日期返回到日期字段
这是我的 Python 代码
tea_worker_ids = self.pool.get('bpl.worker').search(cr, uid, [('bpl_division_id', '=', division_id), ('default_work', '=', 'tea')])
for record in self.pool.get('bpl.worker').browse(cr, uid, tea_worker_ids):
tea_list_data.append({'worker_id': record.id, 'worker_emp_no': record.emp_no, 'is_selected':True,'date': (fields.date.context_today)})#
tea_v['selected_tea_workers'] = tea_list_data
这是错误
2013-05-13 06:22:28,810 15393 ERROR ABC werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/share/pyshared/werkzeug/serving.py", line 159, in run_wsgi
execute(app)
File "/usr/share/pyshared/werkzeug/serving.py", line 146, in execute
application_iter = app(environ, start_response)
File "/usr/share/pyshared/simplejson/__init__.py", line 286, in dumps
return _default_encoder.encode(obj)
File "/usr/share/pyshared/simplejson/encoder.py", line 226, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/share/pyshared/simplejson/encoder.py", line 296, in iterencode
return _iterencode(o, 0)
File "/usr/share/pyshared/simplejson/encoder.py", line 202, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <function context_today at 0xaaa7064> is not JSON serializable
请帮我解决这个问题,
已编辑
当它更改为fields.date.context_today()
然后错误如下
File "/home/bellvantage/Documents/openerp-7.0/openerp-7/openerp/addons/bpl/bpl.py", line 1059, in on_change_division
workers_list.append({'worker_id': record.id,'start_date': fields.date.context_today()})
TypeError: context_today() takes at least 3 arguments (0 given)