Vauxoo/addons-vauxoo

Should we fetch products for all BoM or Only from those where product_id is not NULL

hbto opened this issue · 0 comments

hbto commented

@nhomar
bill_of_materials_-_odoo

        cr.execute('''
            SELECT                                                                                                                                                      
            DISTINCT mb.product_id AS pp1,
                     mbl.product_id AS pp2
            FROM mrp_bom AS mb
            INNER JOIN mrp_bom_line as mbl ON mbl.bom_id = mb.id
            WHERE mb.product_id IS NOT NULL AND mb.active = True;
                ''')

Right now inproduct_extended_variants product_id field is not required,
when execute_cron_splited is called some product.product record can
be skipped from global Cost Update.

What if we change the sql sentence to:

        cr.execute('''
            SELECT                                                                                                                                                      
            DISTINCT mb.**product_tmpl_id** AS pp1,
                     mbl.product_id.**product_tmpl_id** AS pp2
            FROM mrp_bom AS mb
            INNER JOIN mrp_bom_line as mbl ON mbl.bom_id = mb.id
            WHERE mb.active = True;
                ''')

This yields product.template records.

And after processing parenthood, we just fetch back produc.product from the product.template records.

Regards