Am Mittwoch, 23. März 2016 11:55:04 UTC+1 schrieb Cédric Krier:
>
> On 2016-03-23 01:28, TPH wrote:
> > The reason is very simple. I never have used RPC and don't know how to
> > start.
> >
> > Do I have to install local client package e.g. with pip so I can make
> > "import tryton.rpc as rpc"?
> > We do talk about JSON-RPC, doesn't we? Or XML-RPC?
> >
> > May you have links?
> > I found only old ones:
> >
> https://code.google.com/archive/p/tryton/wikis/RemoteCalls.wiki#XML-RPC_in_Python
>
> >
> > Here are also not many informations:
> > http://doc.tryton.org/3.2/trytond/doc/ref/rpc.html
> >
> > I have interests in doing it a better way.
>
> Indeed when I said RPC call, I mean to skip the ActiveRecord pattern of
> proteus and call the method directly from proteus like the method _read
> does:
>
> product_proxy = config.get_proxy('product.product')
> product_proxy.read(ids, fields, context)
>
> with proper ids, fields and context
>
> PS: Please don't top-post on this mailing list, see
> http://groups.tryton.org/netiquette
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: [email protected] <javascript:>
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
Thank you for the help. This is working fast enought !
Is there any disadvantage in this method?
locations = Location.find([('type', '=', 'storage'), ('parent.name', '='
> ,'Main Storage Name')])
> location_ids = [l.id for l in locations]
> config._context['locations'] = location_ids
>
> products = Product.find([('type', '=', 'goods')])
> product_ids = [p.id for p in products]
>
> product_proxy = config.get_proxy('product.product')
> product_informations = product_proxy.read(product_ids, ["code",
> "quantity"], config.context)
>
--
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/4e93aaa6-508b-4896-ba50-8bf9bd0c13a9%40googlegroups.com.