Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Cédric Krier
On 2016-11-24 22:44, Vincent Bastos wrote:
>  ok, so for now I can create an sms_queue module but without updating the
> status of an sms.

I do not think you need a queue [1]. You can also use the 2 phase commit
like the sendmail_transactional does.

[1] https://mikehadlow.blogspot.nl/2012/04/database-as-queue-anti-pattern.html

-- 
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/20161124131730.GU67642%40tetsuo.


Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Oscar Alvarez

On 24/11/16 07:44, Vincent Bastos wrote:



On Thu, Nov 24, 2016 at 10:34 PM, Cédric Krier > wrote:


On 2016-11-24 22:22, Vincent Bastos wrote:
> On Thu, Nov 24, 2016 at 10:17 PM, Sergi Almacellas Abellana <
> se...@koolpi.com > wrote:
>
> > Hi Vincent,
> >
> > El 24/11/16 a les 13:11, Vincent Bastos ha escrit:
> >
> >> Is it possible to create an end point on the server that does not
> >> require authentication?
> >>
> >> I would like to implement a queue to send SMS's using the
Twilio API.
> >> When you send a request to send a message, it is possible to
set a
> >> callback url [1] with a parameter in the domain rather than as a
> >> parameter.
> >>
> >>
> > You can use flask_tryton [1] to create a custom endpoint that
conects to
> > the database and processes the requests. This request won't
require any
> > authentication.
> >
> > Hope it helps,
> >
> > [1] https://pypi.python.org/pypi/flask_tryton/0.6

>
> ok thanks. I had not thought of this.
>
> I'm not sure how to actually implement this in terms of putting
it together
> in a module - if that even makes sense. Can I simple create a flask
> application in my module?

Indeed I think it will be better in 4.2 to use a route without the
user_application decorator but of course you must be careful about the
process because your endpoint will be exposed to anyone.


 ok, so for now I can create an sms_queue module but without updating 
the status of an sms.


We are created a twilio (can be added another plattforms as Clickatell) 
send messsages module in Tryton, maybe help it, you can see here:


https://bitbucket.org/presik/trytonpsk_sms



--
*Vincent Bastos*
*Lava Lab Software*
--
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/CACLX58BXWxUbcRmp9O%3DZRtmD4xYf_KKitpAEmw7MSLK%2B1wcWUA%40mail.gmail.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/5beaf353-786c-0d80-1fa6-47fd19ee3a0e%40gmail.com.


Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Vincent Bastos
On Thu, Nov 24, 2016 at 10:34 PM, Cédric Krier 
wrote:

> On 2016-11-24 22:22, Vincent Bastos wrote:
> > On Thu, Nov 24, 2016 at 10:17 PM, Sergi Almacellas Abellana <
> > se...@koolpi.com> wrote:
> >
> > > Hi Vincent,
> > >
> > > El 24/11/16 a les 13:11, Vincent Bastos ha escrit:
> > >
> > >> Is it possible to create an end point on the server that does not
> > >> require authentication?
> > >>
> > >> I would like to implement a queue to send SMS's using the Twilio API.
> > >> When you send a request to send a message, it is possible to set a
> > >> callback url [1] with a parameter in the domain rather than as a
> > >> parameter.
> > >>
> > >>
> > > You can use flask_tryton [1] to create a custom endpoint that conects
> to
> > > the database and processes the requests. This request won't require any
> > > authentication.
> > >
> > > Hope it helps,
> > >
> > > [1] https://pypi.python.org/pypi/flask_tryton/0.6
> >
> > ok thanks. I had not thought of this.
> >
> > I'm not sure how to actually implement this in terms of putting it
> together
> > in a module - if that even makes sense. Can I simple create a flask
> > application in my module?
>
> Indeed I think it will be better in 4.2 to use a route without the
> user_application decorator but of course you must be careful about the
> process because your endpoint will be exposed to anyone.


 ok, so for now I can create an sms_queue module but without updating the
status of an sms.

-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58BXWxUbcRmp9O%3DZRtmD4xYf_KKitpAEmw7MSLK%2B1wcWUA%40mail.gmail.com.


Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Cédric Krier
On 2016-11-24 22:22, Vincent Bastos wrote:
> On Thu, Nov 24, 2016 at 10:17 PM, Sergi Almacellas Abellana <
> se...@koolpi.com> wrote:
> 
> > Hi Vincent,
> >
> > El 24/11/16 a les 13:11, Vincent Bastos ha escrit:
> >
> >> Is it possible to create an end point on the server that does not
> >> require authentication?
> >>
> >> I would like to implement a queue to send SMS's using the Twilio API.
> >> When you send a request to send a message, it is possible to set a
> >> callback url [1] with a parameter in the domain rather than as a
> >> parameter.
> >>
> >>
> > You can use flask_tryton [1] to create a custom endpoint that conects to
> > the database and processes the requests. This request won't require any
> > authentication.
> >
> > Hope it helps,
> >
> > [1] https://pypi.python.org/pypi/flask_tryton/0.6
> 
> ok thanks. I had not thought of this.
> 
> I'm not sure how to actually implement this in terms of putting it together
> in a module - if that even makes sense. Can I simple create a flask
> application in my module?

Indeed I think it will be better in 4.2 to use a route without the
user_application decorator but of course you must be careful about the
process because your endpoint will be exposed to anyone.

-- 
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/20161124123451.GT67642%40tetsuo.


Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Sergi Almacellas Abellana

El 24/11/16 a les 13:22, Vincent Bastos ha escrit:

ok thanks. I had not thought of this.

I'm not sure how to actually implement this in terms of putting it
together in a module - if that even makes sense. Can I simple create a
flask application in my module?
Of course, but you should take care to run this application as a 
separate process, as the tryton server will not run it for you.


--
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/68f8ed60-9762-1d1a-2551-efbb1b7039a1%40koolpi.com.


Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Vincent Bastos
On Thu, Nov 24, 2016 at 10:17 PM, Sergi Almacellas Abellana <
se...@koolpi.com> wrote:

> Hi Vincent,
>
> El 24/11/16 a les 13:11, Vincent Bastos ha escrit:
>
>> Is it possible to create an end point on the server that does not
>> require authentication?
>>
>> I would like to implement a queue to send SMS's using the Twilio API.
>> When you send a request to send a message, it is possible to set a
>> callback url [1] with a parameter in the domain rather than as a
>> parameter.
>>
>>
> You can use flask_tryton [1] to create a custom endpoint that conects to
> the database and processes the requests. This request won't require any
> authentication.
>
> Hope it helps,
>
> [1] https://pypi.python.org/pypi/flask_tryton/0.6



ok thanks. I had not thought of this.

I'm not sure how to actually implement this in terms of putting it together
in a module - if that even makes sense. Can I simple create a flask
application in my module?

-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58Ad%2BJ1fnVOUdABWd8ER3iz71yzed%2BECbXrP8T%3Df7RZ%3DQQ%40mail.gmail.com.


Re: [tryton-dev] non authenticated end point

2016-11-24 Thread Sergi Almacellas Abellana

Hi Vincent,

El 24/11/16 a les 13:11, Vincent Bastos ha escrit:

Is it possible to create an end point on the server that does not
require authentication?

I would like to implement a queue to send SMS's using the Twilio API.
When you send a request to send a message, it is possible to set a
callback url [1] with a parameter in the domain rather than as a parameter.



You can use flask_tryton [1] to create a custom endpoint that conects to 
the database and processes the requests. This request won't require any 
authentication.


Hope it helps,

[1] https://pypi.python.org/pypi/flask_tryton/0.6
--
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/2a96e538-328f-3b16-a3e4-df4dbbc4a36b%40koolpi.com.


[tryton-dev] non authenticated end point

2016-11-24 Thread Vincent Bastos
Is it possible to create an end point on the server that does not require 
authentication?

I would like to implement a queue to send SMS's using the Twilio API. When 
you send a request to send a message, it is possible to set a callback url 
[1] with a parameter in the domain rather than as a parameter.

[1] 
- https://www.twilio.com/docs/guides/sms/how-to-confirm-delivery-in-python

-- 
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/0e3541d0-469e-49a5-a97a-bcfe4702c1fc%40googlegroups.com.


Re: [tryton-dev] Limit of One2Many

2016-11-24 Thread Cédric Krier
On 2016-11-24 19:22, Vincent Bastos wrote:
> On Thu, Nov 24, 2016 at 6:37 PM, Nicolas Évrard 
> wrote:
> 
> > * Vincent Bastos  [2016-11-24 01:38 +0100]:
> >
> >> How can I see what the maximum number of id's a One2Many field returns?
> >>
> >
> > Just specify size=… in the definition of the One2Many
> >
> > http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html
> > #trytond.model.fields.One2Many.size
> 
> 
> I thought that field was used to limit the number of records?
> 
> I didn't want to limit the number of child records. I wanted to limit the
> number of id's returned in a model.x.read call.

You can not because reading a One2Many means getting all the values for
data integrity.

> It's ok though, I am no longer using the one2many field to get some ids'.

Of course, if you want just some (which means it is not really a
One2Many) the proper way is to use a relate action (searching on the
target model with the right domain and limit).

-- 
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/20161124092826.GS67642%40tetsuo.


Re: [tryton-dev] read order by create_date

2016-11-24 Thread Vincent Bastos
On Thu, Nov 24, 2016 at 6:42 PM, Cédric Krier  wrote:

> On 2016-11-23 22:16, Vincent Bastos wrote:
> > Is there any reason why ordering by create_date wouldn't work?
> >
> > Can't I use the following domain - 'create_date', 'DESC'?
>
> You can but if you have an issue please provide the traceback.
>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/


Sorry for wasting both your times.

I didn't have an error, the ordering was just not working. In case you were
wondering; I removed the following statements from the model and it has
fixed my issue:

cls._order.insert(0, ('create_date', 'DESC'))
cls._order.insert(1, ('number', 'DESC'))
cls._order.insert(2, ('id', 'DESC'))

-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58ChJhFNup9Oi6Cs4fjrXkRxY14N7VV4KDz9kVPBEDN_0Q%40mail.gmail.com.


Re: [tryton-dev] Limit of One2Many

2016-11-24 Thread Vincent Bastos
On Thu, Nov 24, 2016 at 6:37 PM, Nicolas Évrard 
wrote:

> * Vincent Bastos  [2016-11-24 01:38 +0100]:
>
>> How can I see what the maximum number of id's a One2Many field returns?
>>
>
> Just specify size=… in the definition of the One2Many
>
> http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html
> #trytond.model.fields.One2Many.size


I thought that field was used to limit the number of records?

I didn't want to limit the number of child records. I wanted to limit the
number of id's returned in a model.x.read call.

It's ok though, I am no longer using the one2many field to get some ids'.

Cheers

-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58Dr4kd1GUx2_h7RNZW_5SgDZf54D%3Dhprk75xcdn8EoKQQ%40mail.gmail.com.


Re: [tryton-dev] read order by create_date

2016-11-24 Thread Cédric Krier
On 2016-11-23 22:16, Vincent Bastos wrote:
> Is there any reason why ordering by create_date wouldn't work?
> 
> Can't I use the following domain - 'create_date', 'DESC'?

You can but if you have an issue please provide the traceback.

-- 
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/20161124084219.GR67642%40tetsuo.


Re: [tryton-dev] Limit of One2Many

2016-11-24 Thread Nicolas Évrard
* Vincent Bastos  [2016-11-24 01:38 +0100]: 

How can I see what the maximum number of id's a One2Many field returns?


Just specify size=… in the definition of the One2Many

http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html#trytond.model.fields.One2Many.size

--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: nicolas.evr...@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/20161124083736.4ooc4qzvsv2mijjk%40localhost.localdomain.


Re: [tryton-dev] read order by create_date

2016-11-24 Thread Sergi Almacellas Abellana

Hi,

El 24/11/16 a les 07:16, Vincent Bastos ha escrit:

Is there any reason why ordering by create_date wouldn't work?


I don't this so.

Can't I use the following domain - 'create_date', 'DESC'?

Why not?

For me it's working:

>>> from proteus import Model, config
>>> config.set_trytond()
>>> View = Model.get('ir.ui.view')
>>> view, = View.find([], order=[('create_date', 'DESC')], limit=1)
>>> view.id
708
>>> view, = View.find([], limit=1)
>>> view.id
4



--
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/6a2f9bae-b318-e242-d938-60ff78f9a8ba%40koolpi.com.