2013/8/15 Demoy Blake <[email protected]>

> 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.

-- 
Guillem Barba
http://www.guillem.alcarrer.net

Reply via email to