Comment 3 for bug 713221

Revision history for this message
JordiFS (jordi-figuerola) wrote :

I know it is an old thread, but there it goes, for the shake of those that face similar issues:

The solution relies on allowing all products but the one of the BOM. To do this, there have to be changed the view of the form of BOM adding a domain; in the form of [code]domain="[('id','!=', parent.product_id)]"[/code].

In OpenERP vesion 5.0 edit mrp.bom.form view and add the domain as follows:

        <record id="mrp_bom_form_view" model="ir.ui.view">
            <field name="name">mrp.bom.form</field>
            <field name="model">mrp.bom</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Bill of Material">
HERE ==> <field name="product_id" on_change="onchange_product_id(product_id, name)" select="1" domain="[('id','!=', parent.product_id)]"/>
                    <newline/>
                    <field name="product_uom"/>
                    <field name="product_qty"/>
                    <field name="name" select="1"/>

In OpenERP version 6.0 edit mrp.bom.form view and make sure is in:

        <record id="mrp_bom_form_view" model="ir.ui.view">
            <field name="name">mrp.bom.form</field>
            <field name="model">mrp.bom</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Bill of Material">
                    <group colspan="4" col="6">
HERE==> <field name="product_id" on_change="onchange_product_id(product_id, name, context)" select="1" domain="[('id','!=', parent.product_id)]"/>
                        <field name="name" select="1"/>
                        <field name="code" select="1" string="Reference" groups="base.group_extended"/>
                        <newline/>
                        <field name="product_qty"/>

I also I attach patch file if you want to change the source code as well for version 5.0.