Openerp field.function-键错误:40
当我更新值时,创建了一列“line_no”,它抛出KeyError:40 我的代码:Openerp field.function-键错误:40,openerp,Openerp,当我更新值时,创建了一列“line_no”,它抛出KeyError:40 我的代码: def _get_line_no(self, cr, uid, ids, line_no, arg, context=None): res = {} for record in self.browse(cr, uid, ids, context=context): nextno =0 no = record.next_li
def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total =+ next_no
res={
'next_line_no':next_no,
'line_no': total
}
return res
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer'),
'next_line_no':fields.integer(' Next Line No'),
}
_defaults = {
'next_line_no':1
}
抛出错误:键错误:40
如何解析?通过
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="line"),
'next_line_no':fields.function(_get_line_no, type='integer', string='next line number' ,multi="line"),
}
你的方法是
def _get_line_no(self, cr, uid, ids, field_names, args, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
这将起作用。通过
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="line"),
'next_line_no':fields.function(_get_line_no, type='integer', string='next line number' ,multi="line"),
}
你的方法是
def _get_line_no(self, cr, uid, ids, field_names, args, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
这将起作用。通过
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="line"),
'next_line_no':fields.function(_get_line_no, type='integer', string='next line number' ,multi="line"),
}
你的方法是
def _get_line_no(self, cr, uid, ids, field_names, args, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
这将起作用。通过
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="line"),
'next_line_no':fields.function(_get_line_no, type='integer', string='next line number' ,multi="line"),
}
你的方法是
def _get_line_no(self, cr, uid, ids, field_names, args, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
这将起作用。
下一行\u no
是一个数据库字段,因此它不会影响动态方式
您需要以这种方式进行修改
def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="lineno"),
'next_line_no': function(_get_line_no,string='Next Line No',type='integer', multi="lineno", store=True),
}
_defaults = {
'next_line_no':1
}
我希望这会让您大吃一惊。
下一行\u no
是一个数据库字段,因此它不会影响动态方式
您需要以这种方式进行修改
def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="lineno"),
'next_line_no': function(_get_line_no,string='Next Line No',type='integer', multi="lineno", store=True),
}
_defaults = {
'next_line_no':1
}
我希望这会让您大吃一惊。
下一行\u no
是一个数据库字段,因此它不会影响动态方式
您需要以这种方式进行修改
def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="lineno"),
'next_line_no': function(_get_line_no,string='Next Line No',type='integer', multi="lineno", store=True),
}
_defaults = {
'next_line_no':1
}
我希望这会让您大吃一惊。
下一行\u no
是一个数据库字段,因此它不会影响动态方式
您需要以这种方式进行修改
def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total += next_no
res[record.id]={
'next_line_no':next_no,
'line_no': total
}
return res
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="lineno"),
'next_line_no': function(_get_line_no,string='Next Line No',type='integer', multi="lineno", store=True),
}
_defaults = {
'next_line_no':1
}
我希望这会让你大喊大叫。它不会进入for循环抛出错误:AttributeError:“module”对象没有属性“tracebacklimit”哦!我在“total+=next_no”上错放了+它没有进入for循环抛出错误:AttributeError:“module”对象没有属性“tracebacklimit”哦!我在“total+=next_no”上错放了+它没有进入for循环抛出错误:AttributeError:“module”对象没有属性“tracebacklimit”哦!我在“total+=next_no”上错放了+它没有进入for循环抛出错误:AttributeError:“module”对象没有属性“tracebacklimit”哦!我把+放错了“total+=next_no”@AtulArvind谢谢你给+1,所以它对所有人都有用users@dhana如你所愿+1是免费的!:)@dhana我的答案也有同样的建议。@AtulArvind是70%你的答案是正确的,但是
下一行\u no
你的代码没有改变。@dhana,这就是你打败我的地方!我很感激。@AtularFind谢谢,请给出+1,这样对所有人都有用users@dhana如你所愿+1是免费的!:)@dhana我的答案也有同样的建议。@AtulArvind是70%你的答案是正确的,但是下一行\u no
你的代码没有改变。@dhana,这就是你打败我的地方!我很感激。@AtularFind谢谢,请给出+1,这样对所有人都有用users@dhana如你所愿+1是免费的!:)@dhana我的答案也有同样的建议。@AtulArvind是70%你的答案是正确的,但是下一行\u no
你的代码没有改变。@dhana,这就是你打败我的地方!我很感激。@AtularFind谢谢,请给出+1,这样对所有人都有用users@dhana如你所愿+1是免费的!:)@dhana我的答案也有同样的建议。@AtulArvind是70%你的答案是正确的,但是下一行\u no
你的代码没有改变。@dhana,这就是你打败我的地方!我很感激。