Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Facing an error while overriding create() function of mrp.bom

Ashraf Hesham
on 5/20/15, 9:25 AM 568 views

I am trying to override the create() function of mrp.bom and in it i will change the value if a field in product.template , but when i press 'save' i face that error :

res = super(bom_override, self).create(vals)
TypeError: super(type, obj): obj must be an instance or subtype of type

i searched for the reason and every reason i found i checked my code for it and nothing to slove 
i hope that anyone can help me with that.

 here is my code:

class bom_override(models.Model):
    _name = 'mrp.bom'
    _inherit = 'mrp.bom'
    def create(self, vals):
        product_obj = self.env['product.template'].search([('id','=',vals['product_id'])])
        res = super(bom_override, self).create(vals)
        return res

Thanks in advance ..,

Ashraf Hesham
On 5/24/15, 8:11 AM

i found the problem in the code 
someone was duplicating the class name in the same file

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 5/20/15, 9:25 AM
Seen: 568 times
Last updated: 5/24/15, 8:11 AM