[FIX] point_of_sale: invoice created for partner using qr code in receipt

Steps to produce
========================
- Activate QR code in pos config
- Open session
- Make an order for a certain partner (do not invoice)
- At receipt, scan the QR code
- Sign in as a normal user (like admin)
bug - Invoice is created for admin and not the partner in the order

After this commit
========================
The partner of the created invoice will be the partner of the pos order.

task - 3497301

closes odoo/odoo#147484

X-original-commit: 2b45e8732e39f13a6293ffda7bf9fed9e8d951f8
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Parth Solanki (paso) <paso@odoo.com>
This commit is contained in:
Parth Solanki(PASO)
2023-12-27 05:07:00 +00:00
committed by Parth Solanki[PASO]
parent c54a377490
commit 9f06286b2c
+1 -1
View File
@@ -242,7 +242,7 @@ class PosController(PortalAccount):
partner = request.env['res.partner'].sudo().create(partner_values) # In this case, partner_values contains the whole partner info form.
# If the user is connected, then we can update if needed its fields with the additional localized fields if any, then proceed.
else:
partner = (not request.env.user._is_public() and request.env.user.partner_id) or pos_order.partner_id
partner = pos_order.partner_id or (not request.env.user._is_public() and request.env.user.partner_id)
partner.write(partner_values) # In this case, partner_values only contains the additional fields that can be updated.
pos_order.partner_id = partner