commit
32c8cecec0
|
|
@ -25,8 +25,9 @@ class MyController(http.Controller):
|
|||
try:
|
||||
# _logger.info("Processing request for content: xmlid=%s, model=%s, id=%s, field=%s", xmlid, model, id, field)
|
||||
# Access the binary content of the attachment
|
||||
attachment = request.env['ir.attachment'].sudo().browse(id)
|
||||
attachment.public = True
|
||||
if model == 'ir.attachment':
|
||||
attachment = request.env['ir.attachment'].sudo().browse(int(id))
|
||||
attachment.public = True
|
||||
status, headers, content = request.env['ir.http'].sudo().binary_content(
|
||||
xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename,
|
||||
filename_field=filename_field, download=download, mimetype=mimetype, access_token=access_token)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ class Users(models.Model):
|
|||
for u in self:
|
||||
# u.avatar = werkzeug.urls.url_join(base, "rest_api/web/avatar/%d" % u.id)
|
||||
u.avatar = werkzeug.urls.url_join(base, "api/content/res.users/%d/image_1920" % u.id)
|
||||
# //https://ensan25.preprod.exp-sa.com/api/content/res.users/2/image_1920
|
||||
if u.employee_id and u.employee_id.image_1920:
|
||||
u.avatar = werkzeug.urls.url_join(base, "/api/content?model=hr.employee&id=%d&field=image_1920&unique=" % u.employee_id.id)
|
||||
# @api.multi
|
||||
def to_dict(self, single=False):
|
||||
res = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue