Content-Length: 292826 | pFad | http://github.com/odoo/odoo/pull/193881

9E [FIX] pos_online_payment: access error if no customer when paying online by ndd-odoo · Pull Request #193881 · odoo/odoo · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from

Conversation

ndd-odoo
Copy link
Contributor

@ndd-odoo ndd-odoo commented Jan 16, 2025

  • 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

@robodoo
Copy link
Contributor

robodoo commented Jan 16, 2025

Pull request status dashboard

@ndd-odoo
Copy link
Contributor Author

Hello @caburj @thvi-odoo Can you have a look please ? Thank you

@C3POdoo C3POdoo requested review from a team and caburj and removed request for a team January 16, 2025 03:20
@@ -96,7 +96,7 @@ def pos_order_pay(self, pos_order_id, access_token=None, exit_route=None):

user_sudo = request.env.user
if not pos_order_sudo.partner_id:
user_sudo = request.env.ref('base.public_user')
user_sudo = request.env.ref('base.public_user').sudo()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need to use _get_public_user from res.company to get the proper public user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, but that method is in website module, therefore i move it into base module
Please review

* 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 requested 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
@ndd-odoo ndd-odoo force-pushed the v17_fix_pos_online_payment branch from efd31de to d9b0c48 Compare January 17, 2025 01:59
@C3POdoo C3POdoo requested review from a team, Gorash and xmo-odoo and removed request for a team January 17, 2025 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/odoo/odoo/pull/193881

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy