diff --git a/addons/pad/models/pad.py b/addons/pad/models/pad.py index 0393c9820b6..a8a3f838d9d 100644 --- a/addons/pad/models/pad.py +++ b/addons/pad/models/pad.py @@ -64,10 +64,12 @@ class PadCommon(models.AbstractModel): field = model._fields[self.env.context['field_name']] real_field = field.pad_content_field + res_id = self.env.context.get("object_id") + record = model.browse(res_id) # get content of the real field - for record in model.browse(self.env.context.get("object_id")): - if record[real_field]: - myPad.setHtmlFallbackText(path, record[real_field]) + real_field_value = record[real_field] or self.env.context.get('record', {}).get(real_field, '') + if real_field_value: + myPad.setHtmlFallbackText(path, real_field_value) return { "server": pad["server"], diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index fcb49ccd17b..104cc2f5432 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -129,7 +129,8 @@ var FieldPad = AbstractField.extend({ context: { model: this.model, field_name: this.name, - object_id: this.res_id + object_id: this.res_id, + record: this.recordData, }, }, { shadow: true