Skip to Content
Menu
This question has been flagged
1759 Views

Hi,

I want read record from csv file and add in mrp.bom.

but in section add bom line i has problem, please help me.

Thanks.

bom_line_ids???

function:

   mrp_bom_obj = self.env['mrp.bom']
        mrp_search = mrp_bom_obj.search([
            ('code''=', values.get('code'))
                ])

        product_uom = self.find_uom_product(values.get('product_uom_id'))
        product = self.find_product(values.get('default_code'))
        bom_line_ids = []
        if product_uom and product:
            for a in values.get('product_id'):          
                bom_line_ids.create((00,
                            {
                                'product_id': product,
                                'product_qty': values.get('product_qty'),
                                'product_uom_id': product_uom,}))
                            

        product_id = self.find_product_finish(values.get('product_tmpl_id'))
        if product_id:
            abc = {
                    'code' : values.get('code'),
                    'category' : 'test',                             
                    'product_tmpl_id': product_id,
                    'bom_line_ids':[(0,False,[y.id for y in bom_line_ids])] if product_uom and product else False , 
            }
            bom_id = mrp_bom_obj.create(abc)        

            return bom_id



Avatar
Discard