summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-08-09 16:34:44 +0200
committerOlivier Dony <odo@openerp.com>2017-08-09 16:38:56 +0200
commit0de067cae919937cfc5fa4cd3161d58f48d472b5 (patch)
treee32f46ede93beacac12d37b379aea742391534ff
parent0c13beb0cc1bc7a4e31d981a9fe13f41b59d6f80 (diff)
[FIX] pad: do not crash during record creation
Rev. c5bd50927441ba98ae99d56ff765111cf4f6d2f3 attempted to improve the pad sync mechanism when merging records (tasks), but failed to consider the case where the pad_url field is not set yet. This happens at create(), due to the chicken-and-egg problem with the pad URL depending on the record ID, and therefore set *after* creation. Ignoring the sync when the URL is not yet set should be enough, as the URL generation method also takes care of that first sync.
-rw-r--r--addons/pad/models/pad.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/pad/models/pad.py b/addons/pad/models/pad.py
index eb6267ee389..65a8bf5bc5f 100644
--- a/addons/pad/models/pad.py
+++ b/addons/pad/models/pad.py
@@ -117,7 +117,7 @@ class PadCommon(models.AbstractModel):
def _set_pad_value(self, vals):
# Update the pad if the `pad_content_field` is modified
for k, field in self._fields.iteritems():
- if hasattr(field, 'pad_content_field') and vals.get(field.pad_content_field):
+ if hasattr(field, 'pad_content_field') and vals.get(field.pad_content_field) and self[k]:
company = self.env.user.sudo().company_id
myPad = EtherpadLiteClient(company.pad_key, company.pad_server + '/api')
path = self[k].split('/p/')[1]