Odoo 8 值错误 Picking 模块中的预期单例

Odoo 8 value error Expected singleton in Picking module

Odoo 8 在库存操作中遇到错误,只有当交货单上的 1 行生成超过 1 件相同的商品时。为了转移货物,他们需要被小部件分成两行。分配批次后,打印交货单遇到此错误:

Traceback (most recent call last):
  File "/opt/odoo/addons/report/controllers/main.py", line 121, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')
  File "/opt/odoo/openerp/http.py", line 396, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/addons/report/controllers/main.py", line 65, in report_routes
    pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/addons/report/models/report.py", line 186, in get_pdf
    html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/addons/report/models/report.py", line 171, in get_html
    return self.render(cr, uid, [], report.report_name, docargs, context=context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/addons/report/models/report.py", line 147, in render
    return view_obj.render(cr, uid, template, values, context=context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/ir/ir_ui_view.py", line 1015, in render
    return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 253, in render
    return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 430, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 416, in render_tag_foreach
    ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 430, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 416, in render_tag_foreach
    ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 425, in render_tag_if
    return self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    raise_qweb_exception(message="Could not render element %r" % element.tag, node=element, template=template)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 484, in render_tag_field
    element, template_attributes, generated_attributes, qwebcontext, context=qwebcontext.context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 612, in to_html
    source_element, g_att, t_att, qweb_context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 557, in attributes
    ('data-oe-id', record.id),
  File "/opt/odoo/openerp/fields.py", line 1775, in __get__
    return record.ensure_one()._ids[0]
  File "/opt/odoo/openerp/models.py", line 5214, in ensure_one
    raise except_orm("ValueError", "Expected singleton: %s" % self)
QWebException: ('ValueError', 'Expected singleton: stock.production.lot(4473, 4472)')

需要编辑什么文件(以及如何)来解决这个问题?

循环 move.lot_ids 以获取每个批次名称。

<t t-foreach='move.lot_ids' t-as='lot_id'>
    <span t-field="lot_id.name"/>
</t>

使用CSS样式显示地块名称。