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

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

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 :
#2

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!
Lionel.

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

In 5.0 server/bin/osv/osv.py:193:

    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 :
#4

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

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

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 :
#6

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.
Lionel