Hi
El martes, 21 de agosto de 2012, 15:34:32 (UTC+2), Cédric Krier escribió:
>
> On 21/08/12 15:22 +0200, Truckparts Hamburg COM wrote:
> >
> > > It should be something like that (untested):
> > >
> > > stockdate = datetime.date(2012, 1, 1)
> > > with Transaction().set_context(stock_date_end=stockdate):
> > > stock_2012_01_01 = product.quantity
> >
> > I tried this in different variants but can't get it work.
>
> Normally something like this should work:
>
> config.context['stock_date_end'] = stockdate
> product = Product(<id>)
> product.quantity
>
I'm trying to set the active_ids param to the context with proteus this way
>>> Invoice = Model.get('account.invoice')
>>> d = datetime(year=2015, month=12, day=1)
>>> invoices = Invoice.find([('create_date', '>=', d)])
>>> config.set_context({'active_ids': [i.id for i in invoices]})
in order to execute a method of a wizard that takes values from the context
of the transaction, but the transaction context that arrives to the method
has the None value on the active_ids param.
I've tried these too:
>>> config.context['active_ids'] = [i.id for i in invoices]
>>> config._context['active_ids'] = [i.id for i in invoices]
But nothing works properly. I've tested with proteus 3.4.2 and 3.8.1
Could someone tell me what am i doing wrong?
Thank you very much.
> You must set the context before instanciating the record otherwise you
> can not know if it was not yet read before.
>
> --
> Cédric Krier
>
> B2CK SPRL
> Rue de Rotterdam, 4
> 4000 Liège
> Belgium
> Tel: +32 472 54 46 59
> Email/Jabber: [email protected] <javascript:>
> 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/c9837995-d4e4-4ded-a663-cb1b52299fde%40googlegroups.com.