diff options
| author | Robot Odoo <xmo+roboto@odoo.com> | 2019-02-08 20:16:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-08 20:16:33 +0100 |
| commit | f4dc2af71a662a3089ee12e52e2ccdaea6bd6587 (patch) | |
| tree | 81b9a7ec93ff9ee3c6f456b39b26c7682eac7719 /addons/website/models | |
| parent | e6e206b14e3c3f0274b9d8e723ab1f40c53efe68 (diff) | |
| parent | 52b27c4c6b38fec21872c7a5d6aa155da0827d11 (diff) | |
[MERGE] website, *: improve customize dialog + add logo sizing
* portal, web, web_editor
See sub-commits for details.
- Many improvements to the customize dialog 'framework'
(toggle switches, new widgets, ...)
- Optimization of RPCs (including ace editor which shares the same code)
- Move navbar options of the customize menu to the customize dialog
- Add the possibility to control the header logo size
- Add the possibility to control the header font size
task-1904244
closes odoo/odoo#29624
Diffstat (limited to 'addons/website/models')
| -rw-r--r-- | addons/website/models/__init__.py | 1 | ||||
| -rw-r--r-- | addons/website/models/assets.py | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/addons/website/models/__init__.py b/addons/website/models/__init__.py index fd2679198ed..173075aafbf 100644 --- a/addons/website/models/__init__.py +++ b/addons/website/models/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import assets from . import ir_actions from . import ir_attachment from . import ir_http diff --git a/addons/website/models/assets.py b/addons/website/models/assets.py new file mode 100644 index 00000000000..0d2be3d2b91 --- /dev/null +++ b/addons/website/models/assets.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class Assets(models.AbstractModel): + _inherit = 'web_editor.assets' + + def get_view_fields_to_read(self): + res = super(Assets, self).get_view_fields_to_read() + res.append('website_id') + return res + + def _get_custom_attachment(self, custom_url, op='='): + """ + See web_editor.Assets._get_custom_attachment + Extend to only return the attachments related to the current website. + """ + website = self.env['website'].get_current_website() + res = super(Assets, self)._get_custom_attachment(custom_url, op=op) + return res.with_context(website_id=website.id).filtered(lambda x: not x.website_id or x.website_id == website) + + def _get_custom_view(self, custom_url, op='='): + """ + See web_editor.Assets._get_custom_view + Extend to only return the views related to the current website. + """ + website = self.env['website'].get_current_website() + res = super(Assets, self)._get_custom_view(custom_url, op=op) + return res.with_context(website_id=website.id).filter_duplicate() + + def _save_asset_attachment_hook(self): + """ + See web_editor.Assets._save_asset_attachment_hook + Extend to add website ID at attachment creation. + """ + res = super(Assets, self)._save_asset_attachment_hook() + + website = self.env['website'].get_current_website() + if website: + res['website_id'] = website.id + return res + + def _save_asset_view_hook(self): + """ + See web_editor.Assets._save_asset_view_hook + Extend to add website ID at view creation. + """ + res = super(Assets, self)._save_asset_view_hook() + + website = self.env['website'].get_current_website() + if website: + res['website_id'] = website.id + return res |
