Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6147 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 1 24
3380
1
thg 11 24
2317
0
thg 6 24
1106
0
thg 10 17
4976
0
thg 4 25
2986