简体   繁体   English

启动弹出窗口以在 sale.order.line 视图中选择某种类型的产品

[英]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.

相关问题 如何从sale.order.line访问sale.order字段对视图Qweb进行建模 - How to access the sale.order fields from sale.order.line model a view Qweb sale.order.line数量更新 - sale.order.line Quantity Update 如何在Odoo 8的sale.order.line中的onchange_product_id方法中添加功能? - How to add a functionality to onchange_product_id method in sale.order.line in Odoo 8? 我该怎么办? ValueError:预期的单例:sale.order.line(26,27) - What I can do with this error? ValueError: Expected singleton: sale.order.line(26, 27) 如何从sale.order.line发送自定义值到stock.move in odoo - how to send custom value from sale.order.line to stock.move in odoo odoo 中销售订单行中具有库存数量的产品过滤器 - Product filter with stock quantity in sale order line in odoo 如何使用 create function odoo 13 将产品添加到 sale.subscription 订单行 - how to add product to sale.subscription order line using the create function odoo 13 我可以根据Odoo中的销售订单值隐藏销售订单行中的字段列吗? - Can i hide the field's column from Sale order line Based on sale order value In Odoo? 如何从sale_order_line onchange方法获取sale_order.id? 在odoo 9 - How can I get the sale_order.id from sale_order_line onchange method? In odoo 9 如何以编程方式创建销售订单行 (Odoo 13) - How to programmatically create a sale order line (Odoo 13)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM