← Back to team overview

openerp-india team mailing list archive

[Bug 999103] Re: [trunk] mrp_bom._bom_find: unused argument product_uom

 

Hello Ravish,

I think are not speaking of the same thing. Here is the code for
_bom_find (in 6.1 but it has not changed that much in trunk):

    def _bom_find(self, cr, uid, product_id, product_uom, properties=[]):
        """ Finds BoM for particular product and product uom.
        @param product_id: Selected product.
        @param product_uom: Unit of measure of a product.
        @param properties: List of related properties.
        @return: False or BoM id.
        """
        cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
        ids = map(lambda x: x[0], cr.fetchall())
        max_prop = 0
        result = False
        for bom in self.pool.get('mrp.bom').browse(cr, uid, ids):
            prop = 0
            for prop_id in bom.property_ids:
                if prop_id.id in properties:
                    prop += 1
            if (prop > max_prop) or ((max_prop == 0) and not result):
                result = bom.id
                max_prop = prop
        return result

As you can see, the docstring says "Finds BoM for particular product and
product uom." however the product_uom argument is not used at all in the
code. You can provide various values for this parameter and this will
not affect the return value of the method. This is either a bug in the
code (which should be using the parameter but is not), or a backward
compatible signature for an old version of the code in which case the
signature should be updated and a deprecation warning should be issued
when the method is called with a non None value for product_uom.

** Changed in: openobject-addons
       Status: Incomplete => 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/999103

Title:
  [trunk] mrp_bom._bom_find: unused argument product_uom

Status in OpenERP Addons (modules):
  New

Bug description:
  The signature of mrp_bom._bom_find has a product_uom parameter which
  is not used. I think it should be deprecated and removed altogether.
  At the very least the docstring should be fixed to say that the
  argument is ignored, but I believe some code could be simplified and
  made clearer by removing that argument recursively accross the call
  stack.

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


References