restricted groups from odoo15 to odoo16

213 views Asked by At

I have a custom module written in Odoo 15 and working normally, I tried to install it on Odoo 16 but when I try to install the app I get this error.

Field 'company_id' used in domain of field 'journal_ids' ([('company_id','=',company_id)]) is restricted to the group(s) base.group_multi_company.
    
View error context:
    {
             '-16\\odoo_erp_odoo_v16\\custom_addons\\views\\account_account_views.xml',
     'line': 1,
     'name': 'account.account.list.dim.inherited',
     'view': ir.ui.view(4122,),
     'view.model': 'account.account',
     'view.parent': ir.ui.view(3904,),
     'xmlid': 'view_account_list_dim_inherited'}
    The above server error caused the following client error:
    RPC_ERROR: Odoo Server Error
        at makeErrorFromResponse (http://localhost:8069/web/assets/822-dca4335/web.assets_backend.min.js:985:163)
        at XMLHttpRequest.<anonymous> (http://localhost:8069/web/assets/822-dca4335/web.assets_backend.min.js:993:13)
2

There are 2 answers

0
CZoellner On

You've probably have a field definition for journal_ids in this particulary view extension with a domain using company_id.

So just add groups="base.group_multi_company" to this field definition. I'm not really sure why Odoo is restricting it this since v16, but there is no harm in adding the group.

0
adekock11 On

Since Odoo 16, you need to add the field in the view if it is being used in a domain. So a lot of the times you might see something like:

<field name="company_id" invisible="1">

Here is an example in form view and here is an example in a list view.