I am using Odoo 13 and I have a file stored in a fields.Binary with attachment=True (Odoo's default value). How do I obtain the url to that file given a record? I want to store the url to a computed fields.Html so that I can display it on my form view.
This is the code I have at the moment in my py file (models):
class Image(models.Model):
    def _get_image_html(self):
        for elem in self:
            image_url = self.env['ir.attachment'].search([('res_id', '=', str(self.image))], limit=1).url
            elem.image_loc = '<img src="%s"/>' % image_url
    image = fields.Binary(string="Image")
    image_loc = fields.Html(string='Preview 2', compute="_get_image_html")
So far, my code has only been returning a link to /False.
Any help with be much appreciated.
