Skip to content

Commit 5603d3f

Browse files
tobiaszehntnerpablo-cort-s73
authored andcommitted
[18.0][FIX] Fix access error on partner.credit_limit
When users without accounting access are trying to access a Sale Order, they have an access error on the partner field credit_limit (standard Odoo field that is limited to Account groups), which is used when computing the SO's risk_info. Use sudo across in the financial risk modules when accessing partner.credit_limit.
1 parent b87e949 commit 5603d3f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

sale_financial_risk/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Sale Financial Risk
1111
!! This file is generated by oca-gen-addon-readme !!
1212
!! changes will be overwritten. !!
1313
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14-
!! source digest: sha256:314a4eed5b5170489388f89c1260bbb3b6236f9bd2b1c8314f907d302334536f
14+
!! source digest: sha256:e3f2bf368b4b5f14c903f833ca7fd6048f5a8d41a45034f618db87b6464ee8a0
1515
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1616
1717
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

sale_financial_risk/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Sale Financial Risk",
66
"summary": "Manage partner risk in sales orders",
7-
"version": "18.0.1.0.4",
7+
"version": "18.0.1.0.5",
88
"category": "Sales Management",
99
"license": "AGPL-3",
1010
"author": "Tecnativa, Odoo Community Association (OCA)",

sale_financial_risk/models/sale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def evaluate_risk_message(self, partner):
2929
"This sale order exceeds the sales orders risk.\n"
3030
)
3131
elif partner.risk_sale_order_include and (
32-
(partner.risk_total + risk_amount) > partner.credit_limit
32+
(partner.risk_total + risk_amount) > partner.sudo().credit_limit
3333
):
3434
exception_msg = self.env._("This sale order exceeds the financial risk.\n")
3535
return exception_msg

sale_financial_risk/static/description/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ <h1>Sale Financial Risk</h1>
372372
!! This file is generated by oca-gen-addon-readme !!
373373
!! changes will be overwritten. !!
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375-
!! source digest: sha256:314a4eed5b5170489388f89c1260bbb3b6236f9bd2b1c8314f907d302334536f
375+
!! source digest: sha256:e3f2bf368b4b5f14c903f833ca7fd6048f5a8d41a45034f618db87b6464ee8a0
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377377
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/credit-control/tree/18.0/sale_financial_risk"><img alt="OCA/credit-control" src="https://img.shields.io/badge/github-OCA%2Fcredit--control-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/credit-control-18-0/credit-control-18-0-sale_financial_risk"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/credit-control&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>Extends Partner Financial Risk to manage sales orders.</p>

0 commit comments

Comments
 (0)