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/website.py | |
| 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/website.py')
| -rw-r--r-- | addons/website_event_track/models/website.py | 15 |
1 files changed, 15 insertions, 0 deletions
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): |
