On 31 Mar 15:45, yaco wrote:
> 
> 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 must decorate with ModelView.button to get access right management
and you must define it in ModelView._buttons

http://doc.tryton.org/3.4/trytond/doc/ref/models/models.html?highlight=_buttons#trytond.model.ModelView.button
http://doc.tryton.org/3.4/trytond/doc/ref/models/models.html?highlight=_buttons#trytond.model.ModelView._buttons

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

Reply via email to