[英]Launch popup to select a certain type of product in the sale.order.line view
I have been trying since last couple of weeks to add a different BOM fields for each products in sales module order/quotations.自上周以来,我一直在尝试为销售模块订单/报价单中的每个产品添加不同的 BOM 字段。 But unfortunately I could not manage to do so.但不幸的是,我无法做到这一点。 below is the screenshots and codes that I have done so far.下面是我到目前为止所做的屏幕截图和代码。
Here is my codes:这是我的代码:
from odoo import models, fields
class bom_Listing(models.Model):
_inherit = 'product.product'
productName = fields.Char('Product Name')
width = fields.Char('Width')
length = fields.Char('Length')
color = fields.Char('Color')
Xml View xml视图
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="product_normal_form_view" model="ir.ui.view">
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="categ_id" position="after">
<h4 style="color:DarkOrchid;">Add New BOM</h4>
<field name="productName"/>
<field name="width"/>
<field name="length"/>
<field name="color"/>
</field>
</field>
</record>
</data>
</odoo>
What I want is to select a specific product upon clicking the yellow highlighted button and straight away in the pop the fields under (Add New Bom) will be changed to different fields based on the selected product.我想要的是在单击黄色突出显示的按钮后选择特定产品,然后立即在弹出窗口中,(添加新 Bom)下的字段将根据所选产品更改为不同的字段。 If you guys could help me in solving this issue I would be very appreciated for you.如果你们能帮助我解决这个问题,我将不胜感激。
You should change the productName field from char to many2one of product.product object.您应该将 productName 字段从 char 更改为product.product对象的 many2one 。 Add an onchange method on productName field so that when you select any product from the list, onchange will fillup the other fields.在productName字段上添加一个onchange方法,这样当您从列表中选择任何产品时,onchange 将填充其他字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.