2015-03-31 20:45 GMT+02:00 yaco <[email protected]>:

>
> hi there,
>
>
> is it possible to create a button that will just call one function,
> without creating a Wizard or a Workflow?
>
>
> ie:
>
>
> [in party_form.xml]
>
> <button name="say_hello" string="Say Hello" icon="tryton-connect" />
>
>
> [in party.py, inside the Party class]
>
> def say_hello(cls, parties):
>     print "Hello, excuse me, can you tell me where I am..."
>
>
> when i try this, i get the following dialog box after clicking the button:
>
> "Calling method say_hello on model party.party is not allowed!".
>
>
> am i doing something wrong? i tried adding "@classmethod" and
> "@ModelView.button" as decorators, with no luck...


you need to add the button in cls._buttons dictionary in __setup__() method

Reply via email to