odoo/odoo#193881

Created by ndd-odoo
Merged at 82b96009c6fb2029c132416600f8c85bf35031c3

Statuses:

label
ndd-odoo:v17_fix_pos_online_payment
head
362ce45321b4ea79f06d7596a784cd7c959e3765
merged
4 months ago by POS IoT, Joseph Caburnay (jcb)
odoo/odoo
17.0 #193881
18.0 #214550
saas-18.1 #214583
saas-18.2 #214822
saas-18.3 #215042
saas-18.4
19.0
master #215057

[FIX] pos_online_payment: access error if no customer when paying online

  • STEP TO REPRODUCE: Have 2 company (1 is Default San Francisco the other is VN company),Start enviroment in VN company -> config an online payment method with
    Demo/Wire
    Transfer -> Start session and create pos order with no customer then Validate -> Customer scan QR code using mobile (not logged in) -> 403 forbidden error, read the log said: Sorry, Public user for VN company (id=10) doesn't have 'read' access to: User (res.users)
  • REASON: when request.env.ref('base.public_user') it will get public user from San Francisco company while the request user is Public User of VN company, the record rule prevent that
  • SOLUTION: Fix by using method _get_public_user() in res.company, this
    commit also move _get_public_user() from website to base module so other
    modules can use it

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr