[IMP] website: Show "Edit in Website Builder" for terms and conditions

Prveiously the "Edit in Website Builder" button was not shown for terms
and conditions if website is installed, it was shown only if the
website_sale module was installed. This commit fixes that.

task-3342876

closes odoo/odoo#127735

X-original-commit: 079704a2a5ed42ed774318fd8520d108f17222bd
Related: odoo/upgrade#4912
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
moerradi
2023-07-18 14:30:08 +02:00
parent 21c5613bf8
commit b528b3f6cc
3 changed files with 2 additions and 26 deletions
@@ -228,6 +228,8 @@ class ResConfigSettings(models.TransientModel):
def action_update_terms(self):
self.ensure_one()
if hasattr(self, 'website_id') and self.env.user.has_group('website.group_website_designer'):
return self.env["website"].get_client_action('/terms', True)
return {
'name': _('Update Terms & Conditions'),
'type': 'ir.actions.act_window',
@@ -29,7 +29,6 @@ class ResConfigSettings(models.TransientModel):
cart_abandoned_delay = fields.Float(string="Send After", related='website_id.cart_abandoned_delay', readonly=False)
send_abandoned_cart_email = fields.Boolean('Abandoned Email', related='website_id.send_abandoned_cart_email', readonly=False)
add_to_cart_action = fields.Selection(related='website_id.add_to_cart_action', readonly=False)
terms_url = fields.Char(compute='_compute_terms_url', string="URL", help="A preview will be available at this URL.")
module_delivery_mondialrelay = fields.Boolean("Mondial Relay Connector")
group_product_pricelist = fields.Boolean(
@@ -56,11 +55,6 @@ class ResConfigSettings(models.TransientModel):
related='website_id.show_line_subtotals_tax_selection',
)
@api.depends('website_id')
def _compute_terms_url(self):
for record in self:
record.terms_url = '%s/terms' % record.website_id.get_base_url()
@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
@@ -101,10 +95,6 @@ class ResConfigSettings(models.TransientModel):
else:
record.website_id.auth_signup_uninvited = 'b2b'
def action_update_terms(self):
self.ensure_one()
return self.env["website"].get_client_action('/terms', True)
def action_open_extra_info(self):
self.ensure_one()
# Add the "edit" parameter in the url to tell the controller
@@ -1,22 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form_web_terms" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.account.web.terms</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<button name="action_update_terms" position="replace">
<div class="mt8" attrs="{'invisible': [('terms_type', '!=', 'html')]}" groups="website.group_website_designer">
<strong class="align-top">URL: </strong><field name="terms_url"/>
<div>
<button name='action_update_terms' icon="oi-arrow-right" type="object" string="Edit in Website Builder" class="btn-link"/>
</div>
</div>
</button>
</field>
</record>
<record id="res_config_settings_view_form_inherit_sale" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.sale</field>
<field name="model">res.config.settings</field>