我在我的个人计算机上安装了一个模块并且它可以工作,但是当我将它安装在我的工作计算机上时它却没有 (Odoo 14)

问题描述

我有一个问题,我不知道为什么。我创建了一个模块 mrp_custom 并将其安装在我的笔记本电脑上并且运行良好。但是,当我在我的工作计算机上安装时,它不起作用并出现错误。在这里,我展示了我的模型、继承的视图和错误。

P.D.:在我的笔记本电脑上它运行良好,而在另一台电脑上却没有。

模型

# -*- 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 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>

错误

文件“C:\Program Files\Odoo 14\server\odoo\models.py”,第 4983 行,在 ensure_one 中 raise ValueError("预期的单身人士:%s" % self) 异常

上述异常是以下异常的直接原因:

回溯(最近一次调用最后一次):文件“C:\Program Files\Odoo 14\server\odoo\http.py”,第 639 行,在 _handle_exception 中 return super(JsonRequest,self)._handle_exception(exception) File "C:\Program Files\Odoo 14\server\odoo\http.py",line 315,in _handle_exception 从 new_cause ValueError 引发 exception.with_traceback(None):预期的单例:product.template(2582,2657,2624)

解决方法

通过查看此错误:Expected singleton: product.template(2582,2657,2624)。可以有多个 product_template 与单个 product_product 相关。请确保只有一个 product_template 与一个 product_product 相关!

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...