Skip to Content
Menu
This question has been flagged
1 Reply
4080 Views

I have an odoo server with a website and other modules installed. I have two languages, English and Spanish, and I was trying to make make English Inactive. But I get an error "Cannot deactivate a language that is currently used on a website." I have change the Language to Spanish for all Users. including odoo boot and other inactive and internal users, And still it shows an error "Cannot deactivate a language that is currently used on a website.". How can I remove English and let only Spanish as a language

Avatar
Discard
Best Answer

Hi,

If you want to disable an active language in Odoo,you have to remove the language from all fields where you have used it.
Follow the steps to Activate Spanish (AR) and deactive English (US):
1. Enable debug(or developer) mode.
2. Navigate to Settings/ Translations/ Languages and open the Spanish (AR) record and click on "Activate and Translate". In the wizard select all the websites and click on "ADD". In the next wizard, click on "Switch to Spanish (AR) / Español (AR) & Close".
3.Navigate to Website/ Configuration/ Websites. Then, remove English (US) from Languages in all website records. (Add Spanish (AR) if it is not added from step 2). You may have to add the field to the form view if it is not present.

<field name="language_ids" widget="many2many_tags"/>


4. Navigate to Settings/ Users & Companies/ Users and change the Language of all users with Language as English (US)(including the archived users).
5. Navigate to Contacts App and change the Language in the contacts(partners) with Language as English (US)(including the archived contacts).
6. Navigate to Settings/ Translations/ Languages and deactivate English (US) language.

Tip: If you find steps 5 and 6 difficult due to the large number of contacts and users, you can create a scheduled action and use this python code to replace the Language English (US) with Spanish (AR) in all Contacts(Partners) and Users.

To create a scheduled action: Navigate to Settings/ Technical/ Automation/ Scheduled Actions and create a new record. You can select any model and keep the scheduled action as inactive.

Python code

# Select all active/archived contacts with Language English (US) and change it to Spanish (AR)
contacts = env['res.partner'].search([('lang', '=', 'en_US'), ('active', 'in', (True, False))])
if contacts:
contacts.write({'lang': 'es_AR'})

# Select all active/archived users with Language English (US) and change it to Spanish (AR)
users = env['res.users'].search([('lang', '=', 'en_US'), ('active', 'in', (True, False))])
if users:
users.write({'lang': 'es_AR'})

Click on the button "RUN MANUALLY" to execute the scheduled action.


Regards

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 23
1177
0
Apr 22
1277
0
Nov 21
1218
1
Jan 21
2408
0
Nov 24
76