On 2015-09-02 13:30, Raimon Esteve wrote:
> Hie,
> 
> I have a module add new class wizard:
> 
> class TestClass(Wizard):
>     __name__ = 'test.class'
>     start = StateTransition()
>     picking = StateView('test.class.view',
>        ......
>     tasktodo = StateTransition()
>     result = StateView('test.class.result',
>         'module.test_class_result', [
>             Button('Done', 'end', 'tryton-ok'),
>             ])
> 
> I have three modules inherit TestClass to do more features.
> 
> One module, add new btn in result view.
> 
>     @classmethod
>     def __setup__(cls):
>         super(TestClass, cls).__setup__()
>         # add new button: Save Photo
>         cls.result.buttons.insert(0,
>             Button('Save Photo', 'photo', 'tryton-go-next', True))
> 
> When I installed three modules inherit TestClass , I detect this new
> button (Save Photo), are duplicated (three modules = three buttons =
> three registration class).
> 
> The reason is because each module registre class but I can't check if
> new button are in cls.result.buttons to insert or not.
> 
> I solved with add all modules in extra_depends (module add new btn).
> 
> Other way to fix it?

It looks like the buttons list of wizard.State is not copied by
deepcopy:

http://hg.tryton.org/trytond/file/4ff4668e7f2c/trytond/wizard/wizard.py#l186

This should certainly by fixed.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Reply via email to