inherit / overwrite wizard interface

Asked by hsm flxCore

In an existing wizard.interface is a method which I would like to improve with my own module. For regular osv.osv classes the _inherit attribute can be used to point towards the superclass. In wizard.interface this is not possible, so it seems. Can anyone help me out with finding a solution to this?

Question information

English Edit question
Odoo Server (MOVED TO GITHUB) Edit question
No assignee Edit question
Solved by:
Borja López Soilán (NeoPolus)
Last query:
Last reply:
Revision history for this message
Best Borja López Soilán (NeoPolus) (borjals) said :

I'm sorry flxCore, but I think this is the 'very one reason' that makes the 'wizard.interface' wizards deprecated! (osv_memory wizards do support _inherit)
I think you will have to duplicate the full wizard :(

Revision history for this message
Numérigraphe (numerigraphe) said :

If you really need to keep the old wizard interface, you can still refactor the original wizard and move the portion you want to a function in the main object.
Then you can inherit the object and redefine the function.
Don't hesitate to send a branch for merging!

Revision history for this message
Pieter J. Kersten (EduSense BV) (pieterj) said :

In 5.0 server/bin/osv/

    def createInstance(cls, pool, module, cr):
        parent_name = getattr(cls, '_inherit', None)
        name = getattr(cls, '_name', parent_name)
        if parent_name:
            raise NotImplementedError('Inherit not supported in osv_memory object (%s) !' % (parent_name,))

I'm afraid remark #1 only applies to trunk. In 5.0 there's no universal compelling reason to use osv_memory wizards.

Revision history for this message
hsm flxCore (hannes-smit) said :

Thanks Borja López Soilán (Pexego), that solved my question.

Revision history for this message
hsm flxCore (hannes-smit) said :

Thanks. I copied the original wizard code (python) and did an overwrite on the <wizard xml. The (very big) disadvantage is that when the original code is updated/upgraded, I cannot automatically adapt the copied version.

Revision history for this message
Numérigraphe (numerigraphe) said :

hsm flxCore, to if you want to keeping your copy of the code up to date, you may consider working in a bazaar branch and merging the updates in when they are published on Launchpad.