On 2017-06-11 02:59, Dr. Praveen Bhatia wrote:
> Hi,
>    Following code in python/proteus gives UserError.
> 
> 
>     AccountTemplate = Model.get('account.account.template')
>     Account = Model.get('account.account')
>     FiscalYear = Model.get('account.fiscalyear')
>     Sequence = Model.get('ir.sequence')
>     SequenceStrict = Model.get('ir.sequence.strict')
> 
>     root_template, = AccountTemplate.find([
>         ('parent', '=', None),
>         ('name', '=', 'Minimal Account Chart'),
>         ])
>     create_chart_account = Wizard('account.create_chart')
>     create_chart_account.execute('account')
>     create_chart_account.form.account_template = root_template
>     create_chart_account.form.company = company
>     create_chart_account.execute('create_account')
> 
> 
> Keeps giving the error at the last line above:
> 
> UserError: ('UserError', (u'You try to bypass an access rule.\n(Document 
> type: account.account.type)', ''))
> 
> 
> What is the resolution?
> 
> 
> There is one admin user, and one company
> 
> ('Users = ', [proteus.Model.get('res.user')(1)])
> ('User belongs to company : ', proteus.Model.get('company.company')(1))

I guess the context does not put the user into the right company.
Ensure that the context has this company set.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
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/20170613063633.GR3591%40kei.

Reply via email to