[IMP] website: hide website specific settings if no website selected
If there is no website selected, there is no point to show the specific settings (which are supposed to be wrote on website model, that will write on an empty recordset) as it just flood the screen for nothing. If multi website is enabled, tell the user he could select a website to load the settings. If not enabled, the user can't select a website as the select will be hidden. In that case, just tell the user that he could create a new website for this company. More than just a display improvement, it will also prevent misunderstanding of the website settings when an user arrive on the settings with no website selected. Followup of https://github.com/odoo/odoo/pull/34706 closes odoo/odoo#34764 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -53,7 +53,7 @@ class Website(models.Model):
|
||||
domain = fields.Char('Website Domain')
|
||||
country_group_ids = fields.Many2many('res.country.group', 'website_country_group_rel', 'website_id', 'country_group_id',
|
||||
string='Country Groups', help='Used when multiple websites have the same domain.')
|
||||
company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.ref('base.main_company').id, required=True)
|
||||
company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.company, required=True)
|
||||
language_ids = fields.Many2many('res.lang', 'website_lang_rel', 'website_id', 'lang_id', 'Languages', default=_active_languages)
|
||||
default_lang_id = fields.Many2one('res.lang', string="Default Language", default=_default_language, required=True)
|
||||
default_lang_code = fields.Char("Default language code", related='default_lang_id.code', store=True, readonly=False)
|
||||
|
||||
@@ -26,8 +26,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<h2>Website <button name="action_website_create_new" type="object" string="New" class="ml-2 btn btn-link" icon="fa-plus" groups="!website.group_multi_website"/></h2>
|
||||
<div class="row mt16 o_settings_container" id="website_settings">
|
||||
<div class="col-12 o_setting_box" id="website_action_setting">
|
||||
<div class="row mt16 o_settings_container" id="website_settings_placeholder" attrs="{'invisible': [('website_id', '!=', False)]}">
|
||||
<div class="col-12 o_setting_box">
|
||||
<div class="text-muted" groups="website.group_multi_website">
|
||||
Select a website to load its settings.
|
||||
</div>
|
||||
<div class="text-muted" groups="!website.group_multi_website">
|
||||
There is no website available for this company. You could create a new one.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- !! Every fields inside this container should be website specific (related to website record) !! -->
|
||||
<div class="row mt16 o_settings_container" id="website_settings" attrs="{'invisible': [('website_id', '=', False)]}">
|
||||
<div class="col-12 o_setting_box" id="website_action_setting">
|
||||
<button name="website_go_to" type="object" string="Go to Website" class="btn btn-primary" icon="fa-globe"/>
|
||||
<button name="%(website.action_website_add_features)d" type="action" string="Add features" class="ml-2 btn btn-secondary" icon="fa-plus"/>
|
||||
</div>
|
||||
@@ -41,7 +52,7 @@
|
||||
<div class="content-group">
|
||||
<div class="row mt16">
|
||||
<label class="col-lg-3 o_light_label" string="Name" for="website_name"/>
|
||||
<field name="website_name" attrs="{'required': [('website_id', '!=', False)] }"/>
|
||||
<field name="website_name" attrs="{'required': [('website_id', '!=', False)]}"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-lg-3 o_light_label" for="favicon" />
|
||||
|
||||
Reference in New Issue
Block a user