← Back to team overview

openerp-india team mailing list archive

[Bug 1278694] [NEW] [6.1/trunk] Empty BoM creates a duplicate mrp order each time scheduler runs

 

Public bug reported:

When there is a BoM with no items, the scheduler will create a mrp order for this product each time it runs. This results in duplicate mrp orders for the same product. increasing the mrp order count by N x Empty Boms.
In 6.1 check_produce_product():
In trunk: check_bom_exists():
These check for the existance of a BoM.
They do not check for a BoM with no items. They should to prevent the above happening. It is like making something with nothing.

I suggest using the code below in these functions to remove this
problem:

        bom_explode = []
        bom_point = self.pool.get('mrp.bom').browse(cr, uid, bom_id, context=context)
        bom_explode = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties, routing_id=p.routing_id.id)
        bom_items = bom_explode[0]  # Items
        if not bom_items:
            cr.execute('UPDATE procurement_order SET message=%s WHERE id=%s', (_('Empty BoM defined for this product !'), procurement.id))
            for (id, name) in self.name_get(cr, uid, procurement.id):
                message = _("Procurement '%s' has an exception: 'Empty BoM defined for this product !'") % name
                self.log(cr, uid, id, message)
            return False

** Affects: openobject-addons
     Importance: Undecided
         Status: New

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

Title:
  [6.1/trunk] Empty BoM creates a duplicate mrp order each time
  scheduler runs

Status in OpenERP Addons (modules):
  New

Bug description:
  When there is a BoM with no items, the scheduler will create a mrp order for this product each time it runs. This results in duplicate mrp orders for the same product. increasing the mrp order count by N x Empty Boms.
  In 6.1 check_produce_product():
  In trunk: check_bom_exists():
  These check for the existance of a BoM.
  They do not check for a BoM with no items. They should to prevent the above happening. It is like making something with nothing.

  I suggest using the code below in these functions to remove this
  problem:

          bom_explode = []
          bom_point = self.pool.get('mrp.bom').browse(cr, uid, bom_id, context=context)
          bom_explode = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties, routing_id=p.routing_id.id)
          bom_items = bom_explode[0]  # Items
          if not bom_items:
              cr.execute('UPDATE procurement_order SET message=%s WHERE id=%s', (_('Empty BoM defined for this product !'), procurement.id))
              for (id, name) in self.name_get(cr, uid, procurement.id):
                  message = _("Procurement '%s' has an exception: 'Empty BoM defined for this product !'") % name
                  self.log(cr, uid, id, message)
              return False

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


Follow ups

References