Python TypeError:“instancemethod”对象没有属性“\uuuu getitem\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
我试图从模型souches'souches.souche'中获取一个名为'Nom'的特定前缀字段,然后我从一个选择字段名'soucheu sale'中为method a提供搜索参数。 最后的结果是将concatunate添加到名为“prefix”的字符值中。 下面是代码说明Python TypeError:“instancemethod”对象没有属性“\uuuu getitem\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu,python,model,openerp,Python,Model,Openerp,我试图从模型souches'souches.souche'中获取一个名为'Nom'的特定前缀字段,然后我从一个选择字段名'soucheu sale'中为method a提供搜索参数。 最后的结果是将concatunate添加到名为“prefix”的字符值中。 下面是代码说明 def create(self, cr, user, vals, context=None): context = context or {} if ('name' not in vals) or (vals
def create(self, cr, user, vals, context=None):
context = context or {}
if ('name' not in vals) or (vals.get('name') in ('/', False)):
ptype_id = vals.get('picking_type_id', context.get('default_picking_type_id', False))
sequence_id = self.pool.get('stock.picking.type').browse(cr, user, ptype_id, context=context).sequence_id.id
stock_prefixes = self.pool.get[('souches.souche','Nom','=',vals.get('Souche_stock'))].browse(cr, uid, ids)
prefix = [x.Pre_BL for x in stock_prefixes][0]
vals['origin'] = str(prefix) + self.pool.get('ir.sequence').next_by_id(cr, user, sequence_id, context=context)
任何人都可以帮忙
谢谢和问候。这一行有例外吗
stock_prefixes = self.pool.get[('souches.souche','Nom','=',vals.get('Souche_stock'))].browse(cr, uid, ids)
.get是instancemethod。您必须像self.pool.get…,那样调用它,但您尝试使用[]:self.pool.get[..]将回溯编辑到您的问题中吗?