这是我要创建记录时的错误。请告诉我缺失点在哪里。?
File "/home/bellvantage/Documents/openerp-7.0/openerp-7/openerp/addons/bpl/bpl.py", line 394, in create
self.write(cr, uid, [id], {'name': name}, context)
File "/usr/lib/python2.7/dist-packages/psycopg2/extensions.py", line 129, in getquoted
pobjs = [adapt(o) for o in self._seq]
ProgrammingError: can't adapt type 'builtin_function_or_method'
2013-04-26 06:14:07,719 5739 INFO demo werkzeug: 127.0.0.1 - - [26/Apr/2013 06:14:07] "POST /web/dataset/call_kw HTTP/1.1" 200 -
我的代码中的相关行是这样的
def create(self, cr, uid, values, context=None):
name = 'CheckRoll No : ' + str(values['checkroll_no']) + ' & Gang No : ' + str(values['gang_no'])
self.write(cr, uid, [id], {'name': name}, context)
return True
错误出现并表明我的写入方法不正确。似乎我缺少一些参数。需要您的建议来实施模块谢谢..
已编辑
现在错误如下
File "/home/bellvantage/Documents/openerp-7.0/openerp-7/openerp/addons/bpl/bpl.py", line 395, in create
res = super('bpl.work.offer',self).create(cr,uid,values,context=context)
TypeError: must be type, not str
2013-04-26 07:58:43,452 6947 INFO demo werkzeug: 127.0.0.1 - - [26/Apr/2013 07:58:43] "POST /web/dataset/call_kw HTTP/1.1" 200 -
这里显示了我在模型类中的字段
'name': fields.char('Name', size=50),
'checkroll_no': fields.integer('Checkroll No'),
'gang_no': fields.integer('Gang'),
这里显示我调试时的值(在 super.create() 时间),
dict: {'selected_tea_workers_line_ids': [[5, False, False], [0, False, {'worker_emp_no': '1000', 'worker_id':
1, 'tea_line_worker_id': False, 'is_selected': False}]], 'user_id': False, 'is_confirmed': False,
'date_of_offer': '2013-04-26', 'bpl_division_id': 1, 'work_type': 'tea', 'checkroll_no': 10, 'name':
'CheckRoll No : 10 & Gang No : 100', 'selected_rubber_workers_line_ids': [[5, False, False], [0, False,
{'worker_emp_no': '1001', 'worker_id': 2, 'rubber_line_worker_id': False, 'is_selected': False}]],
'work_update_id': False, 'field_no': 15, 'selected_sundry_workers_line_ids': [], 'payment_type':
'normal_work', 'gang_no': 100, 'total_workers': 0, 'no_of_workers': 0, 'norm': 15,
'selected_other_workers_line_ids': [], 'bpl_estate_id': 1, 'select_by': 'by_name'}
现在它的工作。感谢异常现象
最后编辑
def create(self, cr, uid, values, context=None):
name = 'CheckRoll No = ' + str(values['checkroll_no']) + ' & Gang No = ' + str(values['gang_no'])
values.update({'name': name})
return super(bpl_work_offer,self).create(cr,uid,values,context=context)