Python 将数据从一个菜单过滤到另一个菜单
我在制造模块->产品表单(名为“原材料”)中有一个复选框 如果我选中复选框并保存数据,则不应将其保存在产品表单中,而应将其保存在名为“原材料”的单独菜单中,该菜单是我在“制造”模块中手动创建的 如何在Odoo v10中实现这一点 这是我的xml文件Python 将数据从一个菜单过滤到另一个菜单,python,xml,openerp,Python,Xml,Openerp,我在制造模块->产品表单(名为“原材料”)中有一个复选框 如果我选中复选框并保存数据,则不应将其保存在产品表单中,而应将其保存在名为“原材料”的单独菜单中,该菜单是我在“制造”模块中手动创建的 如何在Odoo v10中实现这一点 这是我的xml文件 <record id="raw_materials" model="ir.ui.view"> <field name="name">raw.form.inherit.button</field&g
<record id="raw_materials" model="ir.ui.view">
<field name="name">raw.form.inherit.button</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml" >
<xpath expr="//field[@name='name']" position="after">
<div name="options" groups="base.group_user">
<div>
<field name="raw"/>
<label for="raw"/>
</div>
</div>
</xpath>
</field>
</record>
<record id="product_template_view" model="ir.ui.view">
<field name="name">product.template.search</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<search string="Product">
<separator/>
<filter string="Raw Materials" name="filter_to_raw" domain="[('raw','=',True)]"/>
<separator/>
</search>
</field>
</record>
<record id="product_raw_materials" model="ir.actions.act_window">
<field name="name">Raw Materials</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="context">{"search_default_filter_to_raw":1}</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="search_view_id" ref="product.product_template_search_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p><p>
The product form contains information to simplify the Raw Materials: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
<menuitem id="menu_mrp_product_form" name="Raw Materials" action="mrp.product_template_action"
parent="mrp.menu_mrp_bom" sequence="8"/>
raw.form.inherit.button
产品模板
product.template.search
产品模板
原料
ir.actions.act\u窗口
产品模板
看板、树、表格
形式
{“搜索\默认\筛选\到\原始”:1}
单击以定义新产品。
你必须为你所销售的一切定义一个产品,无论它是
您提供给客户的实物产品、消耗品或服务
客户。
产品表单包含简化原材料的信息:价格、报价中的注释、会计数据、,
采购方法等。
提前谢谢
只需在原材料操作中添加域,如下所示:
<record id="product_raw_materials" model="ir.actions.act_window">
<field name="name">Raw Materials</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="context">{"search_default_filter_to_raw":1}</field>
<field name="domain">[('raw','=',True)]</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="search_view_id" ref="product.product_template_search_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p><p>
The product form contains information to simplify the Raw Materials: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
原料
ir.actions.act\u窗口
产品模板
看板、树、表格
形式
{“搜索\默认\筛选\到\原始”:1}
[('raw','=',True)]
单击以定义新产品。
你必须为你所销售的一切定义一个产品,无论它是
您提供给客户的实物产品、消耗品或服务
客户。
产品表单包含简化原材料的信息:价格、报价中的注释、会计数据、,
采购方法等。
我已经找到了问题的答案
raw.form.inherit.button
产品模板
***原始产品搜索***
产品模板
******
***
***
原料
ir.actions.act\u窗口
产品模板
看板、树、表格
形式
***{“搜索\默认\过滤\到\原始”:True,“默认\销售\确定”:False}***
[('raw','=',True)]
单击以定义新产品。
你必须为你所销售的一切定义一个产品,无论它是
您提供给客户的实物产品、消耗品或服务
客户。
产品表单包含简化原材料的信息:价格、报价中的注释、会计数据、,
采购方法等。
欢迎来到stackoverflow。您必须首先继承save按钮@Aravind manod,但在该产品表单中已经有两个复选框,其中一个用于保存销售模块->产品中的数据,另一个用于保存采购模块->产品中的数据。我希望在单击“原材料”复选框时执行相同的操作它不工作。如果我通过单击“原材料”复选框保存在产品中,它也会保存在产品表单中。但它不应该,而是应该保存在原材料菜单中,这就是我在这里试图实现的。
<record id="product_raw_materials" model="ir.actions.act_window">
<field name="name">Raw Materials</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="context">{"search_default_filter_to_raw":1}</field>
<field name="domain">[('raw','=',True)]</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="search_view_id" ref="product.product_template_search_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p><p>
The product form contains information to simplify the Raw Materials: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
I have found the answer for my question
<record id="raw_materials" model="ir.ui.view">
<field name="name">raw.form.inherit.button</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml" >
<xpath expr="//field[@name='name']" position="after">
<div name="options" groups="base.group_user">
<div>
<field name="raw"/>
<label for="raw"/>
</div>
</div>
</xpath>
</field>
</record>
<record id="***raw_search_view***" model="ir.ui.view">
<field name="name">***raw.product.search***</field>
<field name="model">product.template</field>
***<field name="inherit_id" ref="product.product_template_search_view"/>***
<field name="arch" type="xml">
***<xpath expr="//filter[@name='consumable']" position="after">
<seperator/>
<filter string="Raw Materials" name="filter_to_raw" domain="[('raw','=',True)]"/>
</xpath>***
</field>
</record>
<record id="product_raw_materials" model="ir.actions.act_window">
<field name="name">Raw Materials</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
***<field name="context">{"search_default_filter_to_raw":True,"default_sale_ok":False}</field>***
<field name="domain">[('raw','=',True)]</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="search_view_id" ref="product.product_template_search_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p><p>
The product form contains information to simplify the Raw Materials: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
<menuitem id="menu_mrp_product_form" name="Raw Materials" action="***product_raw_materials***"
parent="mrp.menu_mrp_bom" sequence="8"/>