[IMP] wesbite_form: change custom fields title for mail.mail

task-32212
This commit is contained in:
Jigar Patel
2019-04-19 07:24:02 +00:00
committed by Romain Derie
parent 41b8aa7f91
commit fb51d5c648
+5 -3
View File
@@ -49,9 +49,8 @@ class WebsiteForm(http.Controller):
return json.dumps({'id': id_record})
# Constants string to make custom info and metadata readable on a text field
# Constants string to make metadata readable on a text field
_custom_label = "%s\n___________\n\n" % _("Custom infos") # Title for custom fields
_meta_label = "%s\n________\n\n" % _("Metadata") # Title for meta data
# Dict of dynamically called filters following type of field to be fault tolerent
@@ -176,10 +175,13 @@ class WebsiteForm(http.Controller):
record = request.env[model_name].sudo().with_context(mail_create_nosubscribe=True).create(values)
if custom or meta:
_custom_label = "%s\n___________\n\n" % _("Other Information:") # Title for custom fields
if model_name == 'mail.mail':
_custom_label = "%s\n___________\n\n" % _("This message has been posted on your website!")
default_field = model.website_form_default_field_id
default_field_data = values.get(default_field.name, '')
custom_content = (default_field_data + "\n\n" if default_field_data else '') \
+ (self._custom_label + custom + "\n\n" if custom else '') \
+ (_custom_label + custom + "\n\n" if custom else '') \
+ (self._meta_label + meta if meta else '')
# If there is a default field configured for this model, use it.