Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ addon | version | maintainers | summary
[account_credit_control](account_credit_control/) | 18.0.2.0.2 | | Account Credit Control
[account_credit_control_attach_invoice](account_credit_control_attach_invoice/) | 18.0.1.0.0 | | Extend account credit control to print credit control summary with invoices
[account_credit_control_queue_job](account_credit_control_queue_job/) | 18.0.2.0.0 | | Account Credit Control
[account_financial_risk](account_financial_risk/) | 18.0.1.2.0 | <a href='https://github.com/carlosdauden'><img src='https://github.com/carlosdauden.png' width='32' height='32' style='border-radius:50%;' alt='carlosdauden'/></a> | Manage customer risk
[account_financial_risk](account_financial_risk/) | 18.0.1.2.1 | <a href='https://github.com/carlosdauden'><img src='https://github.com/carlosdauden.png' width='32' height='32' style='border-radius:50%;' alt='carlosdauden'/></a> | Manage customer risk
[account_invoice_overdue_reminder](account_invoice_overdue_reminder/) | 18.0.1.4.0 | <a href='https://github.com/alexis-via'><img src='https://github.com/alexis-via.png' width='32' height='32' style='border-radius:50%;' alt='alexis-via'/></a> | Simple mail/letter/phone overdue customer invoice reminder
[account_invoice_overdue_warn](account_invoice_overdue_warn/) | 18.0.1.0.0 | <a href='https://github.com/alexis-via'><img src='https://github.com/alexis-via.png' width='32' height='32' style='border-radius:50%;' alt='alexis-via'/></a> | Show warning on customer form view if it has overdue invoices
[account_invoice_overdue_warn_sale](account_invoice_overdue_warn_sale/) | 18.0.1.0.0 | <a href='https://github.com/alexis-via'><img src='https://github.com/alexis-via.png' width='32' height='32' style='border-radius:50%;' alt='alexis-via'/></a> | Show overdue warning on sale order form view
[account_payment_return_financial_risk](account_payment_return_financial_risk/) | 18.0.1.0.0 | | Partner Payment Return Risk
[partner_risk_insurance](partner_risk_insurance/) | 18.0.1.0.3 | <a href='https://github.com/Daniel-CA'><img src='https://github.com/Daniel-CA.png' width='32' height='32' style='border-radius:50%;' alt='Daniel-CA'/></a> <a href='https://github.com/sergio-teruel'><img src='https://github.com/sergio-teruel.png' width='32' height='32' style='border-radius:50%;' alt='sergio-teruel'/></a> <a href='https://github.com/omar7r'><img src='https://github.com/omar7r.png' width='32' height='32' style='border-radius:50%;' alt='omar7r'/></a> <a href='https://github.com/Tardo'><img src='https://github.com/Tardo.png' width='32' height='32' style='border-radius:50%;' alt='Tardo'/></a> <a href='https://github.com/Shide'><img src='https://github.com/Shide.png' width='32' height='32' style='border-radius:50%;' alt='Shide'/></a> <a href='https://github.com/rafaelbn'><img src='https://github.com/rafaelbn.png' width='32' height='32' style='border-radius:50%;' alt='rafaelbn'/></a> <a href='https://github.com/yajo'><img src='https://github.com/yajo.png' width='32' height='32' style='border-radius:50%;' alt='yajo'/></a> | Risk insurance partner information
[partner_risk_insurance_product_sticker_invoice_report](partner_risk_insurance_product_sticker_invoice_report/) | 18.0.1.0.1 | <a href='https://github.com/Shide'><img src='https://github.com/Shide.png' width='32' height='32' style='border-radius:50%;' alt='Shide'/></a> <a href='https://github.com/rafaelbn'><img src='https://github.com/rafaelbn.png' width='32' height='32' style='border-radius:50%;' alt='rafaelbn'/></a> | Display a Sticker on Invoice Reports secured with Risk Insurance
[sale_financial_risk](sale_financial_risk/) | 18.0.1.0.7 | | Manage partner risk in sales orders
[sale_financial_risk](sale_financial_risk/) | 18.0.1.0.8 | | Manage partner risk in sales orders
[sale_financial_risk_info](sale_financial_risk_info/) | 18.0.1.0.1 | | Adds risk consumption info in sales orders.
[sale_payment_sheet_financial_risk](sale_payment_sheet_financial_risk/) | 18.0.1.0.0 | | Manage partner risk in sale payment sheet
[stock_financial_risk](stock_financial_risk/) | 18.0.1.0.0 | | Manage partner risk in stock moves
Expand Down
2 changes: 1 addition & 1 deletion account_financial_risk/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Account Financial Risk
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:35ca8aa706fb807506b68e0b2daf27815f218172f612b210306360785ea41e92
!! source digest: sha256:afe6d1cfbe9ba49246b36b462f278685d6b2d2f1615fe43de83e02e4de9597c8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_financial_risk/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Account Financial Risk",
"summary": "Manage customer risk",
"version": "18.0.1.2.0",
"version": "18.0.1.2.1",
"category": "Accounting",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion account_financial_risk/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h1>Account Financial Risk</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:35ca8aa706fb807506b68e0b2daf27815f218172f612b210306360785ea41e92
!! source digest: sha256:afe6d1cfbe9ba49246b36b462f278685d6b2d2f1615fe43de83e02e4de9597c8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/account_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-account_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>
<p>Adds a new page in partner to manage its <em>Financial Risk</em>. (Only visible
Expand Down
17 changes: 13 additions & 4 deletions account_financial_risk/tests/test_account_financial_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from dateutil.relativedelta import relativedelta
from freezegun import freeze_time

from odoo import Command, fields
from odoo.exceptions import UserError

from odoo.addons.base.tests.common import BaseCommon


@freeze_time("2024-01-15 12:00:00")
class TestPartnerFinancialRisk(BaseCommon):
@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -104,6 +106,13 @@ def setUpClass(cls):
)
)
cls.env.user.lang = False
# Use the same "today" reference _max_risk_date_due() itself
# compares against (context_today(), timezone-aware) rather than
# the naive Date.today() - with time frozen above this doesn't
# change which day either resolves to, but it keeps the test
# exercising the exact same date computation the module uses
# instead of one that merely happens to agree with it right now.
cls.today = fields.Date.context_today(cls.env.user)

def test_invoices(self):
self.partner.risk_invoice_draft_include = True
Expand Down Expand Up @@ -134,7 +143,7 @@ def test_invoices(self):
unrisk_partners = self.partner.search([("risk_exception", "=", False)])
self.assertIn(self.partner, unrisk_partners)
self.partner.risk_invoice_open_limit = 300.0
invoice2.invoice_date_due = fields.Date.today()
invoice2.invoice_date_due = self.today
wiz_dic = invoice2.action_post()
wiz = self.env[wiz_dic["res_model"]].browse(wiz_dic["res_id"])
self.assertEqual(
Expand All @@ -152,7 +161,7 @@ def test_invoices(self):
self.assertAlmostEqual(self.partner.risk_invoice_open, 0.0)
wiz.button_continue()
# HACK: Force the maturity date for not having an error here
invoice2.line_ids.write({"date_maturity": fields.Date.today()})
invoice2.line_ids.write({"date_maturity": self.today})
self.assertAlmostEqual(self.partner.risk_invoice_open, 550.0)
self.assertTrue(self.partner.risk_allow_edit)

Expand All @@ -163,7 +172,7 @@ def test_other_account_amount(self):
.create(
{
"journal_id": self.journal_sale.id,
"date": fields.Date.today(),
"date": self.today,
"line_ids": [
Command.create(
{
Expand Down Expand Up @@ -191,7 +200,7 @@ def test_other_account_amount(self):
line.date_maturity = "2017-01-01"
self.assertAlmostEqual(self.partner.risk_account_amount, 0.0)
self.assertAlmostEqual(self.partner.risk_account_amount_unpaid, 100.0)
line.date_maturity = fields.Date.today() - relativedelta(days=2)
line.date_maturity = self.today - relativedelta(days=2)
self.assertAlmostEqual(self.partner.risk_account_amount, 0.0)
self.assertAlmostEqual(self.partner.risk_account_amount_unpaid, 100.0)
line.company_id.invoice_unpaid_margin = 3
Expand Down
2 changes: 1 addition & 1 deletion sale_financial_risk/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Sale Financial Risk
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cff17e58f0a237f8853780958db9fdb297034b72987acef5e0177fdcde937529
!! source digest: sha256:855b38feb350e134064f1bc35bd9c0ca5c61ab67a6e4a557cad73a03435b343c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion sale_financial_risk/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Sale Financial Risk",
"summary": "Manage partner risk in sales orders",
"version": "18.0.1.0.7",
"version": "18.0.1.0.8",
"category": "Sales Management",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion sale_financial_risk/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h1>Sale Financial Risk</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cff17e58f0a237f8853780958db9fdb297034b72987acef5e0177fdcde937529
!! source digest: sha256:855b38feb350e134064f1bc35bd9c0ca5c61ab67a6e4a557cad73a03435b343c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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>
<p>Extends Partner Financial Risk to manage sales orders.</p>
Expand Down
12 changes: 12 additions & 0 deletions sale_financial_risk/tests/test_payment_financial_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ def test_payment_risk_bypass(self):
"""When the order confirmation come from a payment authorization the risk
is bypassed. This is a trimmed version of sale/tests/test_11_so_payment_link
to easily test that case"""
# /payment/pay (PaymentHttpCommon._get_portal_pay_context(), used
# below) is a website=True route (odoo/addons/payment/controllers/
# portal.py) - it 404s unless the website module is installed, even
# though neither this module nor its declared dependencies
# (sale, account_financial_risk) require it. Skip rather than fail
# on an install that deliberately doesn't carry website.
if (
not self.env["ir.module.module"]
.sudo()
.search_count([("name", "=", "website"), ("state", "=", "installed")])
):
self.skipTest("website is not installed")
# Force risk exception to whatever amount
self.assertFalse(self.partner.risk_exception)
self.amount = self.order.amount_total
Expand Down