summaryrefslogtreecommitdiff
path: root/addons/website_form/models
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-07-07 14:30:30 +0200
committerChristophe Simonis <chs@odoo.com>2017-07-07 14:30:30 +0200
commitbf51fe55a149fb642a410f579dc4b6dcbd794eac (patch)
treef4f208f06094bcef6541fd1fc034e0265de4ad21 /addons/website_form/models
parentbf32940142beb879211b7034bb77a7845c9d0555 (diff)
parent0f2b2c4e2b99df8d68456016a4bea86e26c1c80e (diff)
[MERGE] forward port branch saas-16 up to 0f2b2c4e2b9
Diffstat (limited to 'addons/website_form/models')
-rw-r--r--addons/website_form/models/models.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/addons/website_form/models/models.py b/addons/website_form/models/models.py
index 75a2ce33fb2..654fbfa9ee4 100644
--- a/addons/website_form/models/models.py
+++ b/addons/website_form/models/models.py
@@ -27,12 +27,6 @@ class website_form_model(models.Model):
website_form_default_field_id = fields.Many2one('ir.model.fields', 'Field for custom form data', domain="[('model', '=', model), ('ttype', '=', 'text')]", help="Specify the field which will contain meta and custom form fields datas.")
website_form_label = fields.Char("Label for form action", help="Form action label. Ex: crm.lead could be 'Send an e-mail' and project.issue could be 'Create an Issue'.")
- def _all_inherited_model_ids(self):
- return list(itertools.chain(
- [self.id],
- *(m._all_inherited_model_ids() for m in self.inherited_model_ids)
- ))
-
def _get_form_writable_fields(self):
"""
Restriction of "authorized fields" (fields which can be used in the
@@ -40,16 +34,16 @@ class website_form_model(models.Model):
builders and are writable. By default no field is writable by the
form builder.
"""
- excluded = {
+ included = {
field.name
for field in self.env['ir.model.fields'].sudo().search([
- ('model_id', 'in', self._all_inherited_model_ids()),
- ('website_form_blacklisted', '=', True)
+ ('model_id', '=', self.id),
+ ('website_form_blacklisted', '=', False)
])
}
return {
k: v for k, v in pycompat.items(self.get_authorized_fields(self.model))
- if k not in excluded
+ if k in included
}
@api.model