diff options
| author | Pierre Paridans <app@odoo.com> | 2020-08-26 08:52:09 +0000 |
|---|---|---|
| committer | Pierre Paridans <app@odoo.com> | 2020-08-26 08:52:09 +0000 |
| commit | 5bcfe45fd917dd2fabb2fcca93bb409ec733b608 (patch) | |
| tree | de2a078798e1e7e2454719b3b2124d24b0dc0552 /addons/website_event_track/models | |
| parent | 9fc27e8232ae1f0d697fa1435a2902181661a24d (diff) | |
[IMP] website_event_track: allow customization of the PWA's name
This commit adds a website-specific and customizable app name for the
Events' Progressive Web Application, configurable through the website's
settings.
Defaults to '<website_name> Events'.
closes odoo/odoo#56542
X-original-commit: 423076ddf1da0fc61d9a18dc19bbbbf900e3dad6
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Diffstat (limited to 'addons/website_event_track/models')
| -rw-r--r-- | addons/website_event_track/models/__init__.py | 1 | ||||
| -rw-r--r-- | addons/website_event_track/models/res_config_settings.py | 10 | ||||
| -rw-r--r-- | addons/website_event_track/models/website.py | 15 |
3 files changed, 26 insertions, 0 deletions
diff --git a/addons/website_event_track/models/__init__.py b/addons/website_event_track/models/__init__.py index a9c5599582c..e07e0223f3a 100644 --- a/addons/website_event_track/models/__init__.py +++ b/addons/website_event_track/models/__init__.py @@ -11,6 +11,7 @@ from . import event_track_tag from . import event_track_tag_category from . import event_track_visitor from . import event_type +from . import res_config_settings from . import website from . import website_event_menu from . import website_menu diff --git a/addons/website_event_track/models/res_config_settings.py b/addons/website_event_track/models/res_config_settings.py new file mode 100644 index 00000000000..8d87e90d9ff --- /dev/null +++ b/addons/website_event_track/models/res_config_settings.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + events_app_name = fields.Char('Events App Name', related='website_id.events_app_name', readonly=False) diff --git a/addons/website_event_track/models/website.py b/addons/website_event_track/models/website.py index e00fde4b94f..dc418b1b47b 100644 --- a/addons/website_event_track/models/website.py +++ b/addons/website_event_track/models/website.py @@ -5,13 +5,28 @@ from PIL import Image from odoo import api, fields, models +from odoo.exceptions import ValidationError from odoo.tools import ImageProcess +from odoo.tools.translate import _ class Website(models.Model): _inherit = "website" app_icon = fields.Image(string='Website App Icon', compute='_compute_app_icon', store=True, readonly=True, help='This field holds the image used as mobile app icon on the website (PNG format).') + events_app_name = fields.Char(string='Events App Name', compute='_compute_events_app_name', store=True, readonly=False, help="This fields holds the Event's Progressive Web App name.") + + @api.depends('name') + def _compute_events_app_name(self): + for website in self: + if not website.events_app_name: + website.events_app_name = _('%s Events') % website.name + + @api.constrains('events_app_name') + def _check_events_app_name(self): + for website in self: + if not website.events_app_name: + raise ValidationError(_('"Events App Name" field is required.')) @api.depends('favicon') def _compute_app_icon(self): |
