UserError: You try to bypass an access rule. Document type: account.account.type

88 views
Skip to first unread message

Dr. Praveen Bhatia

unread,
Jun 11, 2017, 5:59:14 AM6/11/17
to tryton
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))

Dr. Praveen Bhatia

unread,
Jun 11, 2017, 6:25:25 AM6/11/17
to tryton


On Sunday, June 11, 2017 at 6:59:14 PM UTC+9, 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)', ''))


Also, how do we know what access rules we are bypassing? There is my some access rules file?  

Cédric Krier

unread,
Jun 13, 2017, 2:40:06 AM6/13/17
to tryton
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: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Reply all
Reply to author
Forward
0 new messages