I using Odoo14 community version,
I want to add qr code on my POS receipt, the data inside the qr code is public URL on the pos.order model.
I have done with the code how to open pos.order model from public url, like open customer invoice url that using access token.
here is my snippet of code:
class PosOrder(models.Model):
_name = 'pos.order'
_inherit = ['pos.order', 'mail.thread', 'mail.activity.mixin', 'portal.mixin']
portal_mixin_id = fields.Many2one('portal.mixin', 'Portal Mixin')
qr_code_url = fields.Char(string='QR Code URL', default='qr code url', compute='_compute_qr_code_url')
def _compute_qr_code_url(self):
self.qr_code_url = self.get_full_url()
def get_full_url(self):
self.ensure_one()
base_url = self.env["ir.config_parameter"].get_param("web.base.url")
url_params = {
'id': self.id,
'action': self.env.ref('point_of_sale.action_pos_pos_form').id,
'model': 'pos.order',
'view_type': 'form',
'cids': self.env.user.company_id.id,
'menu_id': self.env.ref('point_of_sale.menu_point_ofsale').id,
}
params = '/web?#%s' % werkzeug.url_encode(url_params)
return base_url + params
qr_code_url field contain the url access from public user without login.
Now, I want to add the qr_code_url field onto qr code that attached on POS receipt, but I don't know how to do that.
I try to add the code like this to showing qr code on receipt: (sorry if I add image screenshot here, because the same code bellow that I paste here always got hidden after I save this post)
But the value from qr_code_url field from pos.order model is not passing onto the barcode.
So, the point of my questions is, how to add new field from custom module to Odoo14 POS receipt?
Please, any help, source or tutorial how to do that will be appreciated.
Thanks,
Tri Nanda