[IMP] base,base_setup: Improve general languages settings

Purpose of the task is, We saw that users encounter difficulties
while installing languages so improve the user onboarding experience
when user wants to install a new language.

So in this commit,
 - Change the load langauge wizard title as 'Add Language' and rename
the button as 'Add'
 - Removed documentation link as it is not up to date
 - Added the 'Add language' button to general settings and it will open
the wizard to load the languages. and move the 'manage language' button
to the debug mode.
 - After install added button 'switch to (lang)	& close' to switch to
newly added language.

closes odoo/odoo#53581

Taskid: 2281393
Closes: #53581
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Nisha Patel <nit@odoo.com>
This commit is contained in:
shs-odoo
2020-07-17 12:47:34 +00:00
committed by Barad Mahendra
co-authored by Nisha Patel
parent 00dd5b224b
commit d35adaa030
3 changed files with 15 additions and 5 deletions
@@ -80,9 +80,11 @@
<span class='o_form_label' attrs="{'invisible':[('language_count', '&lt;=', '1')]}">
Languages
</span>
<a href="https://www.odoo.com/documentation/user/13.0/general/odoo_basics/choose_language.html" title="Documentation" class="o_doc_link" target="_blank"></a>
</div>
<div class="mt8">
<button name="%(base.action_view_base_language_install)d" icon="fa-arrow-right" type="action" string="Add Language" class="btn-link"/>
</div>
<div class="mt8" groups="base.group_no_one">
<button name="%(base.res_lang_act_window)d" icon="fa-arrow-right" type="action" string="Manage Languages" class="btn-link"/>
</div>
</div>
@@ -55,3 +55,10 @@ class BaseLanguageInstall(models.TransientModel):
'type': 'ir.actions.client',
'tag': 'reload',
}
def switch_lang(self):
self.env.user.lang = self.lang
return {
'type': 'ir.actions.client',
'tag': 'reload_context',
}
@@ -13,22 +13,23 @@
<field name="overwrite" groups="base.group_no_one"/>
</group>
<group states="done" colspan="4">
<span class="o_form_label">The selected language has been successfully installed.
You must change the preferences of the user to view the changes.</span>
<span class="o_form_label"><strong><field name="lang" readonly="True" force_save="1"/></strong> has been successfully installed.
Users can choose his favorite language in their preferences.</span>
</group>
<footer states="init">
<button name="lang_install" string="Load" type="object" class="btn-primary"/>
<button name="lang_install" string="Add" type="object" class="btn-primary"/>
<button special="cancel" string="Cancel" class="btn-secondary"/>
</footer>
<footer states="done">
<button name="reload" string="Close" type="object" class="btn-primary"/>
<button name="switch_lang" type="object" class="btn-primary">Switch to <field name="lang" readonly="True" force_save="1"/> &amp; Close</button>
</footer>
</form>
</field>
</record>
<record id="action_view_base_language_install" model="ir.actions.act_window">
<field name="name">Load a Translation</field>
<field name="name">Add Language</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.language.install</field>
<field name="view_mode">form</field>