Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6015 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

You cab refer this module, which adds qr code in pos receipt: https://github.com/odoo/odoo/tree/14.0/addons/l10n_sa_pos


See: https://www.youtube.com/watch?v=cTE4T31qhvo&t=218s

Thanks

Awatar
Odrzuć
Autor

Hi Niyas, thank you very much, this is really what I want for my KSA client

Powiązane posty Odpowiedzi Widoki Czynność
2
sty 24
3269
1
lis 24
2113
0
cze 24
1002
0
paź 17
4833
0
kwi 25
2830