[FIX] pad: prevent concat bool and string

Before installing pads, create a second company
On the first company, create a task and initialize its pad

Switch companies and try to edit the task

Before this commit:
There is a traceback because since the pad credentials of the second company are not set,
the url cannot be computed

After this commit, we prevent the Null field to concat with a string
hence there is no traceback

OPW 1837059
closes #24263
This commit is contained in:
Lucas Perais (lpe)
2018-04-18 11:03:22 +02:00
parent ffdfbed42c
commit 20f5f625f4
+2 -2
View File
@@ -75,7 +75,7 @@ class PadCommon(models.AbstractModel):
@api.model
def pad_get_content(self, url):
company = self.env.user.sudo().company_id
myPad = EtherpadLiteClient(company.pad_key, company.pad_server + '/api')
myPad = EtherpadLiteClient(company.pad_key, (company.pad_server or '') + '/api')
content = ''
if url:
split_url = url.split('/p/')
@@ -132,7 +132,7 @@ class PadCommon(models.AbstractModel):
for k, field in self._fields.items():
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')
myPad = EtherpadLiteClient(company.pad_key, (company.pad_server or '') + '/api')
path = self[k].split('/p/')[1]
myPad.setHtmlFallbackText(path, vals[field.pad_content_field])