Skip to Content
Menu
This question has been flagged
1 Reply
3322 Views

I have a checkbox in Manufacturing module-> Products form (Named "Raw Materials")


If I select the checkbox and save the data it should not get saved in the products form but else it should be saved in a separate menu called Raw materials which I created manually in Manufacturing module.


How to achieve this in Odoo v10?


This is my xml file......


    <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"/>


   


Thanks in advance

Avatar
Discard
Author Best Answer

This is the code for the question which I raised above.



<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}</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>

Avatar
Discard
Related Posts Replies Views Activity
0
Aug 22
1716
4
Oct 17
9366
0
Jul 19
3224
2
Jun 24
489
1
Dec 23
574