Re: [tryton] Open a record from button click

2017-12-06 Thread Khurram Shahzad
On Wed, Dec 6, 2017 at 1:56 PM, Cédric Krier  wrote:

> On 2017-12-06 09:56, Khurram Shahzad wrote:
> > On Tue, Dec 5, 2017 at 11:12 PM, Cédric Krier 
> wrote:
> >
> > > On 2017-12-04 13:15, Khurram Shahzad wrote:
> > > > How can I open a record from button's click event in order to
> view/edit
> > > > this record?
> > >
> > > Have you considered to use a Many2One?
> > >
> >
> > The idea is good; but I want to run some code which will show the record
> > only if a certain condition is met.
>
> If the code is simple enough you can use the invisible state with a
> PYSON expression.
>

Thanks; that's cool too!


> > > Otherwise you must use a wizard that return an action window with the
> > > record id in res_id. You can find an example in CreateMove.do_open_ of
> > > account module.
> > >
> > I have used this method, but, it requires a lot of coding effort! I was
> > looking for returning the action with res_id from the button's
> > click-handler.
>
> Action are generic so we made balanced choices between simple usage and
> complex. So yes it requires some code.
>
> --

Regards,
Khurram.

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/CAM3N3CyDVa2ruysUqoKQSz8aCtQkmmTVk0UPy_8edYKdbpJ%2BtA%40mail.gmail.com.


Re: [tryton] Open a record from button click

2017-12-06 Thread Cédric Krier
On 2017-12-06 09:56, Khurram Shahzad wrote:
> On Tue, Dec 5, 2017 at 11:12 PM, Cédric Krier  wrote:
> 
> > On 2017-12-04 13:15, Khurram Shahzad wrote:
> > > How can I open a record from button's click event in order to view/edit
> > > this record?
> >
> > Have you considered to use a Many2One?
> >
> 
> The idea is good; but I want to run some code which will show the record
> only if a certain condition is met.

If the code is simple enough you can use the invisible state with a
PYSON expression.

> > Otherwise you must use a wizard that return an action window with the
> > record id in res_id. You can find an example in CreateMove.do_open_ of
> > account module.
> >
> I have used this method, but, it requires a lot of coding effort! I was
> looking for returning the action with res_id from the button's
> click-handler.

Action are generic so we made balanced choices between simple usage and
complex. So yes it requires some code.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20171206085608.GB30979%40kei.


Re: [tryton] Open a record from button click

2017-12-06 Thread Khurram Shahzad
On Tue, Dec 5, 2017 at 11:12 PM, Cédric Krier  wrote:

> On 2017-12-04 13:15, Khurram Shahzad wrote:
> > How can I open a record from button's click event in order to view/edit
> > this record?
>
> Have you considered to use a Many2One?
>

The idea is good; but I want to run some code which will show the record
only if a certain condition is met.


> Otherwise you must use a wizard that return an action window with the
> record id in res_id. You can find an example in CreateMove.do_open_ of
> account module.
>
I have used this method, but, it requires a lot of coding effort! I was
looking for returning the action with res_id from the button's
click-handler.

Any further thoughts? Thanks for the response!

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/CAM3N3CzBjoqrxJwQD9v%2BLXJSuGnwS-GvW02vOyy9GwyECK7oEA%40mail.gmail.com.


Re: [tryton] Open a record from button click

2017-12-05 Thread Cédric Krier
On 2017-12-04 13:15, Khurram Shahzad wrote:
> How can I open a record from button's click event in order to view/edit
> this record?

Have you considered to use a Many2One?

Otherwise you must use a wizard that return an action window with the
record id in res_id. You can find an example in CreateMove.do_open_ of
account module.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20171205181239.GT7109%40kei.