This commit is contained in:
gsinghpal
2026-05-22 18:01:31 -04:00
parent d127e19b45
commit f661724c72
34 changed files with 1011 additions and 59 deletions

View File

@@ -15,6 +15,15 @@ class ResConfigSettings(models.TransientModel):
string='Enable RingCentral Faxing',
config_parameter='fusion_faxes.ringcentral_enabled',
)
ff_show_send_fax_button = fields.Boolean(
string='Show "Send Fax" Button on Sale Orders & Invoices',
config_parameter='fusion_faxes.show_send_fax_button',
default=True,
help='When enabled, the "Send Fax" header button appears on '
'sale order and invoice forms (for users in the Fax User '
'group). Turn off to hide the button without removing '
'fax-user access.',
)
ff_ringcentral_server_url = fields.Char(
string='RingCentral Server URL',
config_parameter='fusion_faxes.ringcentral_server_url',
@@ -103,7 +112,15 @@ class ResConfigSettings(models.TransientModel):
}
def set_values(self):
"""Protect credential fields from being blanked accidentally."""
"""Protect credential fields from being blanked accidentally
and force-persist the Send Fax Boolean.
Odoo's stock ``set_param`` removes the row when a Boolean
config_parameter is False, which makes the ``get_param``
fallback default kick in — toggling OFF then would silently
re-show the button. We bypass that by writing 'True' / 'False'
as a string after super() runs so the row always exists.
"""
protected_keys = [
'fusion_faxes.ringcentral_client_id',
'fusion_faxes.ringcentral_client_secret',
@@ -122,4 +139,9 @@ class ResConfigSettings(models.TransientModel):
existing = ICP.get_param(key, '')
if existing:
ICP.set_param(key, existing)
return super().set_values()
res = super().set_values()
ICP.set_param(
'fusion_faxes.show_send_fax_button',
'True' if self.ff_show_send_fax_button else 'False',
)
return res