Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.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 编程错误:运算符不存在:整数=布尔-Odoo v9社区_Python_Openerp_Odoo 9 - Fatal编程技术网

Python 编程错误:运算符不存在:整数=布尔-Odoo v9社区

Python 编程错误:运算符不存在:整数=布尔-Odoo v9社区,python,openerp,odoo-9,Python,Openerp,Odoo 9,我有这个方法,它应该创建一个新的stock.pickingfromfleet.vehicle.log.services @api.multi def create_picking(self): self.ensure_one() vals = { 'x_location_src_id': self.x_location_src_id.id, 'x_location_dest_id': self.x_location_dest_id.

我有这个方法,它应该创建一个新的
stock.picking
from
fleet.vehicle.log.services

    @api.multi
    def create_picking(self):
    self.ensure_one()
    vals = {
        'x_location_src_id': self.x_location_src_id.id,
        'x_location_dest_id': self.x_location_dest_id.id,
        'product_id': self.product_id.id,  # shouldn't be set on stock.picking, products are handled on it's positions (stock.move)
        'product_uom_qty': self.product_uom_qty  # the same as for product_id
    }
    picking = self.env['stock.picking'].create(vals)
    return picking
这些字段在模型中声明如下:

x_location_src_id = fields.Many2one('stock.location', string=u'Ubicacion Origen de Productos', required=True,
                                   readonly=False, 
                                   help="Location where the system will look for components.")
x_location_dest_id = fields.Many2one('stock.location', string=u'Ubicacion Destino de Productos', required=True,
                                    readonly=False, default=_static_location,
                                    help="Location where the system will look for components.")
product_id = fields.Many2one('product.template', "Producto")
product_uom_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0)
stock_picking = fields.Many2one("stock.picking", "Picking",) # required=True
然后我在视图上有一个按钮,它调用
create\u picking
方法

    <record model='ir.ui.view' id='fleet_vehicle_log_services_form_inherit'>
        <field name='name'>fleet.vehicle.log.services.form</field>
        <field name='model'>fleet.vehicle.log.services</field>
        <field name='inherit_id' ref='fleet.fleet_vehicle_log_services_form'/>
        <field name="priority">90</field>
        <field name='arch' type='xml'>
            <xpath expr="//form//sheet//group[1]" position="before">
                <div class="oe_title">
            <label for="name" class="oe_edit_only" />
            <h1>
                <field name="name" />
            </h1>
            </div>
            </xpath>
            <xpath expr="//form/sheet/group" position="after">
                <group string="Ubicaciones de Productos" col="2">
                <group><field name="stock_picking"/></group>
                <group string="Datos del picking">
                    <button name="create_picking" string="Crear Picking" type="object" class="oe_highlight"/>
                        <tree decoration-info="state == 'draft'" decoration-muted="state in ('cancel','done')" decoration-danger="state in ('confirmed','waiting')" string="Products to Consume">
                            <field name="product_id"/>
                            <field name="product_uom_qty"/>
                            <field name="x_location_src_id"/>
                            <field name="x_location_dest_id"/>
                            <field name="state" invisible="1"/>
                        </tree>
                </group>
              </group>
            </xpath>
        </field>
    </record>
第1行:从ir_序列中选择number_next,其中id=False表示更新。。。 ^ 提示:没有与给定名称和参数类型匹配的运算符。您可能需要添加显式类型转换

我猜序列有错误,创建拣货时缺少一些必填字段


另外,假设创建了此拾取,我如何知道或指定它应该是一个
OUT
type one?

我认为您在创建时缺少
picking\u type\u id
字段。拣货类型保存其拣货的序列,而Odoo显然需要一个序列来创建拣货(名称)

Traceback (most recent call last):
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 648, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 685, in dispatch
result = self._call_function(**self.params)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 321, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 314, in checked_call
result = self.endpoint(*a, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 964, in __call__
return self.method(*args, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 514, in response_wrap
response = f(*args, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/web/controllers/main.py", line 892, in call_button
action = self._call_kw(model, method, args, {})
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/web/controllers/main.py", line 880, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 381, in old_api
result = method(recs, *args, **kwargs)
File "/home/kristian/odoov9/danisan/fleet_stock/models/fleet_vehicle_services.py", line 216, in create_picking
picking = self.env['stock.picking'].create(vals)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 490, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/stock/stock.py", line 804, in create
vals['name'] = self.pool.get('ir.sequence').next_by_id(cr, user, sequence_id, context=context)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 381, in old_api
result = method(recs, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_sequence.py", line 259, in next_by_id
return self._next()
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_sequence.py", line 245, in _next
return self._next_do()
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_sequence.py", line 187, in _next_do
number_next = _update_nogap(self, self.number_increment)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_sequence.py", line 61, in _update_nogap
self.env.cr.execute("SELECT number_next FROM %s WHERE id=%s FOR UPDATE NOWAIT" % (self._table, self.id))
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/sql_db.py", line 141, in wrapper
return f(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/sql_db.py", line 220, in execute
res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean