Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Migrate the code from odoo7 to odoo 8 or 9 to include parent level class in OpenERP-7

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 856
    Comment on it

    When we migrate the code from odoo7 to odoo 8 or 9 then we change only few import classes and some specifics field, rest will remain same, this will helps to migrate code successfully.


    In below example I have written Python script to Include only parent level class. Like below python code in .py file and this file need to .xml file also.

      def addMaterialsRecursive(components, products, bom_lines): 
                    if not bom_lines: 
                        return components 
                        for bom in bom_lines: 
                            if not in products: 
                        product_ids = map(lambda x:, bom_lines) 
                        sids =, uid, [ 
                                           ('bom_id', '=', False), 
                                           ('product_id', 'in', product_ids) 
                        for bom in self.browse(cr, uid, sids): 
                            addMaterialsRecursive(components, products, 
                bom_parent = self.browse(cr, uid, bom_id, context=context) 
                components = [] 
                products = [] 
                addMaterialsRecursive(components, products, bom_parent.bom_lines) 
                result[bom_id] = components 
            return result


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: