diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-09-22 15:23:45 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-09-22 15:23:45 +0200 |
| commit | 856476d4418390ca89ef161e31faf61248eeaa1d (patch) | |
| tree | f87ab29316440a28e9032d1b811eeb7ea5155653 /addons/pad/models | |
| parent | 4b812d9965128b02b4ac5ea49a66da622953cddc (diff) | |
| parent | b1b700adb1f26bb43e8f4b77b85f969a4b52d36c (diff) | |
[MERGE] forward port branch saas-12 up to b1b700a
Diffstat (limited to 'addons/pad/models')
| -rw-r--r-- | addons/pad/models/pad.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/addons/pad/models/pad.py b/addons/pad/models/pad.py index e1ab1b111b6..5df19a7e3fb 100644 --- a/addons/pad/models/pad.py +++ b/addons/pad/models/pad.py @@ -98,7 +98,20 @@ class PadCommon(models.AbstractModel): @api.model def create(self, vals): self._set_pad_value(vals) - return super(PadCommon, self).create(vals) + pad = super(PadCommon, self).create(vals) + + # In case the pad is created programmatically, the content is not filled in yet since it is + # normally initialized by the JS layer + for k, field in self._fields.iteritems(): + if hasattr(field, 'pad_content_field') and k not in vals: + ctx = { + 'model': self._name, + 'field_name': k, + 'object_id': pad.id, + } + pad_info = self.with_context(**ctx).pad_generate_url() + pad[k] = pad_info.get('url') + return pad # Set the pad content in vals def _set_pad_value(self, vals): |
