I have a problem and I do not know why. I created a module mrp_custom
and I installed it on my laptop and works perfectly. However, when I install on my work computer, it doesn't work and gives an error. Here I show my model, the inherited view and the error.
P.D.: On my laptop it works perfectly and on the other computer it does not.
Model
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class MRPProductsName(models.Model): # FUNCION DEL CAMPO PARA PRODUCTOS SOLO
_inherit = 'mrp.production'
products_name = fields.Char('Producto', related="product_id.product_tmpl_id.name")
Inherited View
<!-- INHERITED VIEW PRODUCTION -->
<record id="view_production_form_inherit" model="ir.ui.view">
<field name="name">view.production.form.inherit</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_tree_view"/>
<field name="arch" type="html">
<xpath expr="//field[@name='product_id']" position="after">
<field name="products_name" optional="show"/>
</xpath>
</field>
</record>
Error
File "C:\Program Files\Odoo 14\server\odoo\models.py", line 4983, in ensure_one raise ValueError("Expected singleton: %s" % self) Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Program Files\Odoo 14\server\odoo\http.py", line 639, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "C:\Program Files\Odoo 14\server\odoo\http.py", line 315, in _handle_exception raise exception.with_traceback(None) from new_cause ValueError: Expected singleton: product.template(2582, 2657, 2624)
By looking in this error: Expected singleton: product.template(2582, 2657, 2624)
. There can be multiple product_template related to single product_product. Please make sure there only one product_template related to one product_product!