[FIX] pad: do not crash during record creation
Rev. c5bd509274 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.
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user