Activity log for bug #1016549

Date Who What changed Old value New value Message
2012-06-22 13:39:00 Equipo OPENTIA (http://www.opentia.com) bug added bug
2012-06-22 13:39:00 Equipo OPENTIA (http://www.opentia.com) attachment added handles False returned by action_before_exporting_grouped_product() https://bugs.launchpad.net/bugs/1016549/+attachment/3200288/+files/product.py.patch
2012-06-22 14:37:57 Equipo OPENTIA (http://www.opentia.com) description This is the method in product_product(product_mag_osv): def action_before_exporting_grouped_product(self, cr, uid, id, external_referential_ids=None, defaults=None, context=None): logger = logging.getLogger('ext synchro') if context.get('mrp_is_installed', False): bom_ids = self.read(cr, uid, id, ['bom_ids'])['bom_ids'] if len(bom_ids): # it has or is part of a BoM cr.execute("SELECT product_id, product_qty FROM mrp_bom WHERE bom_id = %s", (bom_ids[0],)) #FIXME What if there is more than a materials list? results = cr.dictfetchall() child_ids = [] quantities = {} for row in results: child_ids.append(row['product_id']) quantities.update({row['product_id']: row['product_qty']}) if child_ids: #it is an assembly and it contains the products child_ids: self.ext_export(cr, uid, child_ids, external_referential_ids, defaults, context) #so we export them else: return False else: logger.error("OpenERP 'grouped' products will export to Magento as 'grouped products' only if they have a BOM and if the 'mrp' BOM module is installed") return quantities, child_ids There are inconsistencies in this method: - if NOT mrp_is_installed, we don't initialize 'quantities' and 'child_ids' variables - if mrp_is_installed but there are no BOMs, we return False The first one is an error itself, because the method uses those variables at the end of the execution, within the 'return' statement The second one results in a "TypeError: 'bool' object is not iterable", because the code that uses it does not expect a False: quantities, child_ids = self.action_before_exporting_grouped_product(cr, uid, id, external_referential_ids, defaults, context) Attached is a patch that mitigates the stop in the execution. Don't know if it is valid in terms of this module logic though. Greetings, This report is for ======================== Openerp6.1-legacy-module ======================== This is the method in product_product(product_mag_osv):     def action_before_exporting_grouped_product(self, cr, uid, id, external_referential_ids=None, defaults=None, context=None):         logger = logging.getLogger('ext synchro')         if context.get('mrp_is_installed', False):             bom_ids = self.read(cr, uid, id, ['bom_ids'])['bom_ids']             if len(bom_ids): # it has or is part of a BoM                 cr.execute("SELECT product_id, product_qty FROM mrp_bom WHERE bom_id = %s", (bom_ids[0],)) #FIXME What if there is more than a materials list?                 results = cr.dictfetchall()                 child_ids = []                 quantities = {}                 for row in results:                     child_ids.append(row['product_id'])                     quantities.update({row['product_id']: row['product_qty']})                 if child_ids: #it is an assembly and it contains the products child_ids:                     self.ext_export(cr, uid, child_ids, external_referential_ids, defaults, context) #so we export them             else:                 return False         else:             logger.error("OpenERP 'grouped' products will export to Magento as 'grouped products' only if they have a BOM and if the 'mrp' BOM module is installed")         return quantities, child_ids There are inconsistencies in this method:   - if NOT mrp_is_installed, we don't initialize 'quantities' and 'child_ids' variables   - if mrp_is_installed but there are no BOMs, we return False The first one is an error itself, because the method uses those variables at the end of the execution, within the 'return' statement The second one results in a "TypeError: 'bool' object is not iterable", because the code that uses it does not expect a False: quantities, child_ids = self.action_before_exporting_grouped_product(cr, uid, id, external_referential_ids, defaults, context) Attached is a patch that mitigates the stop in the execution. Don't know if it is valid in terms of this module logic though. Greetings,
2012-08-01 14:59:49 Alexandre Fayolle - camptocamp summary Export Catalog broken if product_type == 'grouped' [6.1-legacy] Export Catalog broken if product_type == 'grouped'
2012-08-01 15:00:28 Alexandre Fayolle - camptocamp tags bom catalog export grouped mrp 6.1-legacy bom catalog export grouped mrp
2012-08-01 15:32:43 Alexandre Fayolle - camptocamp magentoerpconnect: assignee Guewen Baconnier @ Camptocamp (gbaconnier-c2c)
2012-08-02 07:46:49 Alexandre Fayolle - camptocamp branch linked lp:magentoerpconnect/openerp6.1-legacy-module
2012-08-02 07:49:00 Alexandre Fayolle - camptocamp magentoerpconnect: status New Triaged