[tryton-dev] Use of PYSONEncoder on printed reports

2018-06-29 Thread Josias Pérez
Hi,

I was using PYSONEncoder with Wizards to open custom actions with dates as 
context and it works well. 

But when I was use it with wizards but with reports this doesn't filter 
according to the context (dates).

I read the docs about PYSONENCODER [1] but I didn't find any recommendation to 
use it with printed reports. 

BTW, I am still working on a printed version of Balance Sheet, you can check 
the module here [2] and see the use of PYSONEncoder. 

Any help will be usefull. 

[1] 
http://doc.tryton.org/4.8/trytond/doc/ref/pyson.html?highlight=pysonencoder#encoder-and-decoder

[2] https://github.com/iehoshia/training_iesa/blob/master/account_report/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/97ce2df3-ebfa-4bb4-a35f-f3c34eed0443%40googlegroups.com.


Re: [tryton-dev] Open a view as result of button click

2018-06-29 Thread Carlos Gálvez
2018-06-29 10:39 GMT+02:00 Cédric Krier :

>
> button_action is not limited to wizard, it can be used for any action.
>
> This would be cleaner to use the button_action decorator.
>


2018-06-29 11:36 GMT+02:00 Sergi Almacellas Abellana :
>
>
> This is the same as button_acciont('mymodule.myaction') which is simplier.
>
>
> > and adding a domain to this act_window:
> >
> > 
>
> Of course, if the new created records are related to the current records
> a domain can be used to remove the wizard.
>
> Just for the record if myfield is a many2one field, there is no need to
> include the '.id' part and this will avoid and extra join to the target
> table.
>
>
You're right, i tried with a button_action and I obtained the same result
with a more clean code.

Thanks to both of you!

*Carlos Gálvez*
Developer
*carlos.gal...@nan-tic.com *

*http://www.NaN-tic.com  *

*Telf: (+34) 935 531 803 <+34%20935%2053%2018%2003> *

*http://twitter.com/nan_tic  *

*http://www.nan-tic.com/blog *

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


Re: [tryton-dev] Vibora similar to Flask

2018-06-29 Thread Cédric Krier
On 2018-06-29 11:59, Sergi Almacellas Abellana wrote:
> El 29/06/18 a les 11:10, Cédric Krier ha escrit:
> > Indeed at B2CK after some experiences with Flask-Tryton, we think that
> > this is no more a best way to interface website with trytond. We think
> > about using dedicated RPC calls in the future.
> 
> When you talk about RPC calls you mean also a specific endpoint using
> the new custom routing feature?

I think it is to be decided case by case.

> How do you think it's better to consume those APIs? Using javascript
> directly or by using an intermediary webserver?

Idem.
Indeed we have done both cases.

-- 
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-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20180629102242.GN3931%40kei.


Re: [tryton-dev] Vibora similar to Flask

2018-06-29 Thread Sergi Almacellas Abellana
El 29/06/18 a les 11:10, Cédric Krier ha escrit:
> Indeed at B2CK after some experiences with Flask-Tryton, we think that
> this is no more a best way to interface website with trytond. We think
> about using dedicated RPC calls in the future.

When you talk about RPC calls you mean also a specific endpoint using
the new custom routing feature?

How do you think it's better to consume those APIs? Using javascript
directly or by using an intermediary webserver?



-- 
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/568fa7e4-3492-35cb-40ff-355d31ed8639%40koolpi.com.


Re: [tryton-dev] Open a view as result of button click

2018-06-29 Thread Sergi Almacellas Abellana
El 29/06/18 a les 09:52, Carlos Gálvez ha escrit:
> 
> The way I have done it is returning on my Modelview.button an Action id
> that points to an act_window that open the desired view:
> 
> return Action.get_action_id(ModelData.get_id('mymodule', 'myaction'))
> 

This is the same as button_acciont('mymodule.myaction') which is simplier.


> and adding a domain to this act_window:
> 
> 

Of course, if the new created records are related to the current records
a domain can be used to remove the wizard.

Just for the record if myfield is a many2one field, there is no need to
include the '.id' part and this will avoid and extra join to the target
table.


-- 
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/b408dab5-6b33-2c24-3c43-c488037d46ac%40koolpi.com.


Re: [tryton-dev] Vibora similar to Flask

2018-06-29 Thread Cédric Krier
On 2018-06-28 08:32, Oscar Alvarez wrote:
> Interesting new tool, it maybe in future can be used with Tryton ;)
> 
> https://vibora.io/?ref=stackshare

I do not think it worse the investment to change all the code base of
Tryton to be async. Indeed async ORM may be strange to use without
talking about the Transaction context switch.

But for a website like an webshop, it could be interesting and it will
be not difficult if the communication with trytond is made via RPC.
Indeed at B2CK after some experiences with Flask-Tryton, we think that
this is no more a best way to interface website with trytond. We think
about using dedicated RPC calls in the future.

-- 
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-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20180629091015.GL3931%40kei.


Re: [tryton-dev] Open a view as result of button click

2018-06-29 Thread Cédric Krier
On 2018-06-29 09:52, Carlos Gálvez wrote:
> 2018-06-28 14:47 GMT+02:00 Sergi Almacellas Abellana :
> >
> >
> > Yes, it is possible. You should use the button_action decorator to
> > returns an wizard with an StateAction from the model of the new created
> > instance.
> >
> > You should set the res_id of the action on the wizard to the ids of the
> > new created instances.
> 
> 
> Finally, I did not use a "button_action" decorator to return an assistant
> because
> I was not interested in having a wizard dirtying my code, but his
> suggestions showed me the way.

button_action is not limited to wizard, it can be used for any action.

> The way I have done it is returning on my Modelview.button an Action id
> that points to an act_window that open the desired view:
> 
> return Action.get_action_id(ModelData.get_id('mymodule', 'myaction'))

This would be cleaner to use the button_action decorator.

-- 
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-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20180629083908.GK3931%40kei.


Re: [tryton-dev] Open a view as result of button click

2018-06-29 Thread Carlos Gálvez
Hi Sergi,

2018-06-28 14:47 GMT+02:00 Sergi Almacellas Abellana :
>
>
> Yes, it is possible. You should use the button_action decorator to
> returns an wizard with an StateAction from the model of the new created
> instance.
>
> You should set the res_id of the action on the wizard to the ids of the
> new created instances.


Finally, I did not use a "button_action" decorator to return an assistant
because
I was not interested in having a wizard dirtying my code, but his
suggestions showed me the way.

The way I have done it is returning on my Modelview.button an Action id
that points to an act_window that open the desired view:

return Action.get_action_id(ModelData.get_id('mymodule', 'myaction'))

and adding a domain to this act_window:




Yours gratefully,

*Carlos Gálvez*
Developer
*carlos.gal...@nan-tic.com *

*http://www.NaN-tic.com  *

*Telf: (+34) 935 531 803 <+34%20935%2053%2018%2003> *

*http://twitter.com/nan_tic  *

*http://www.nan-tic.com/blog *

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