Hello
I have a function field that returns a string. The string is supposed to be a url pointing to a pdf file on the server. I have the function created and I know that the correct url is getting generated. The problem is that string is not showing correctly on the view.
The field on the view is using a 'url' widget so that it becomes a hyperlink that can be clicked
The link looks like this right now: http://[object Object]
I would like it to show something like this: http://127.0.01/document_folder/some_pdf_file.pdf
Here is my python function:
def _append_inv_url_2_uuid(self, cr, uid, ids, field, args, context=None):
res = {}
for rec in self.browse(cr, uid, ids, context):
# look up the invoice url by the key name instead of the value.
# this way if the value changes then no changes will have to be made here
def_url_id = self.pool.get('ir.config_parameter').search(cr, uid, [('key','=','Invoice uuid URL')])[0]
# get the value of the url key
url_str = self.pool.get('ir.config_parameter').browse(cr, uid, def_url_id).value
# get the uuid from the sale order
uuid = "so?id=%s" % self.browse(cr, uid, ids[0]).uuid
whole_string = "%s%s" % (url_str, uuid)
res.update({rec.id: {'invoice_url': str(whole_string)}})
return res
Here is the field in the form view: <field name="invoice_url" widget="url" />