← Back to team overview

openerp-india team mailing list archive

[Bug 713221] Re: BOM Allows Self reference "recursion error"

 

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.

** Patch added: "Adds a domain to limit child products to be same as father (self reference)"
   https://bugs.launchpad.net/openobject-addons/+bug/713221/+attachment/3485429/+files/mrp_view_bom_domain.patch

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/713221

Title:
  BOM Allows Self reference "recursion error"

Status in OpenERP Addons (modules):
  Fix Released

Bug description:
  When creating a BOM for a product OpenERP allows you to add the
  product in the bom as a component product. What happens is that while
  processing the bom it tries to reproduce the product over and over
  again causing a recursion maximum limit error.

  When creating BOM it should not allow you to add the product that is
  the bom as a component. It should check and deny so later when you
  have over a 1,000 bom you do not have to figure out which one is
  causing the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/713221/+subscriptions