On Thursday, August 15, 2013 8:14:53 AM UTC-5, Cédric Krier wrote:
>
> On 15/08/13 14:52 +0200, Guillem Barba Domingo wrote:
> > 2013/8/15 Demoy Blake <[email protected] <javascript:>>
> >
> > > I am making a script to import remote data then create patient records
> > > from data.
> > > the scripts are working individually but called from a tryton wizard I
> > > receive these errors.
> > >
> > > File "/trytond/modules/aa/aa.py", line 110, in map_Mdata
> > > with Transaction().start(dbname, 0, context=CONTEXT):
> > > File "/trytond/transaction.py", line 70, in start
> > > assert self.user is None
> > > AssertionError
> > >
> > > here is line 110 in map_Mdata mentioned above
> > >
> > > dbname = 'admin'
> > > CONTEXT={}
> > >
> > > Pool.start()
> > > pool = Pool(dbname)
> > > Cache.clean(dbname)
> > >
> > > # Line 110
> > > with Transaction().start(dbname, 0, context=CONTEXT):
> > > pool.init()
> > >
> > > with Transaction().start(dbname, 0, context=CONTEXT):
> > > user_obj = pool.get('res.user')
> > > user = user_obj.search([('login', '=', 'admin')], limit=1)[0]
> > > user_id = user.id
> > >
> >
> > the second parameter of Transaction.start() is the user. You set it as 0
> =>
> > no user.
>
> This is not the problem, it is that he starts a transaction inside a
> transaction.
>
> --
> Cédric Krier
>
> Thank you for the explaination.
How can i avoid/end the transaction created when opening the wizard (or
better still how can I reuse the existing transaction).