Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python TypeError:“instancemethod”对象没有属性“\uuuu getitem\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu_Python_Model_Openerp - Fatal编程技术网

Python TypeError:“instancemethod”对象没有属性“\uuuu getitem\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

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

我试图从模型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.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[..]

将回溯编辑到您的问题中吗?