Skip to content

Instantly share code, notes, and snippets.

@vijoin
Last active June 25, 2020 11:07
Show Gist options
  • Save vijoin/48cb7ab01b04312741f432e302d053d0 to your computer and use it in GitHub Desktop.
Save vijoin/48cb7ab01b04312741f432e302d053d0 to your computer and use it in GitHub Desktop.
[Odoo] Be carefull when overriding a method wich return a wizard or any other view

Be carefull when override a method wich return a wizard or any other view

In example,

class A(models.Model):
    _name = 'module.modelA'

    def method(self)
        ....
        ....
        return {
                'name': "Purchase Alert",
                'res_model': "purchase.alert.wizard",
                'src_model': "purchase.purchase",
                'view_mode': "form",
                'target': "new",
                'type': 'ir.actions.act_window',
                'view_id': action_id,
            }



class AInherit(models.Model):
    _inherit = 'module.modelA'

    def method(self):
        do_something ...
        res = super(AInherit, self).method()
        do something else
        return res
        
        ```
The trick is to save what returns the super class and return it again in your method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment