summaryrefslogtreecommitdiff
path: root/addons/website/wizard/website_robots.py
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2020-07-14 14:32:37 +0000
committerVictor Feyens <vfe@odoo.com>2020-07-23 16:38:17 +0000
commit5dc8b7bdd8ea8a760d1929333cd8461047e5b4e6 (patch)
treea726b57bea6d1f801f802767396e2f7f736725c4 /addons/website/wizard/website_robots.py
parent71ab12840bc787ca486202255cd6faa21281b9e1 (diff)
[IMP] *: replace default_get overrides by default attribute on fields.
Leave the generic management of fields default to the orm as much as possible. * Default method is not called unless necessary. * Default values are correctly post-processed by the orm when necessary.
Diffstat (limited to 'addons/website/wizard/website_robots.py')
-rw-r--r--addons/website/wizard/website_robots.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/addons/website/wizard/website_robots.py b/addons/website/wizard/website_robots.py
index 7172a3aa6b1..1d68aa4f22a 100644
--- a/addons/website/wizard/website_robots.py
+++ b/addons/website/wizard/website_robots.py
@@ -7,14 +7,7 @@ class WebsiteRobots(models.TransientModel):
_name = "website.robots"
_description = "Robots.txt Editor"
- content = fields.Text()
-
- @api.model
- def default_get(self, fields):
- defaults = super(WebsiteRobots, self).default_get(fields)
- if 'content' in fields:
- defaults['content'] = self.env['website'].get_current_website().robots_txt
- return defaults
+ content = fields.Text(default=lambda s: s.env['website'].get_current_website().robots_txt)
def action_save(self):
self.env['website'].get_current_website().robots_txt = self.content