From ddf9d61f6ad6789ab59a89d3932c2dc74f645969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 25 Feb 2025 14:22:51 +0100 Subject: [PATCH 1/2] [FIX] agreement_rebate: Fallback to load CoA Since odoo/odoo@d0342c8, the default existing company is not getting a CoA automatically, provoking than the current tests fail with the error: odoo.exceptions.UserError: No journal could be found in company My Company (San Francisco) for any of those types: sale Thus, we put tests post-install for being sure localization modules are installed, the same as AccountTestInvoicingCommon does, but we don't inherit from it, as it creates an overhead creating 2 new companies and loading their CoA and some more stuff, while we don't need all of that. Besides, if you don't have `l10n_generic_coa` installed, you can't use another CoA (like `l10n_es`) easily, so we put little code to select the first available CoA. --- agreement_rebate/tests/test_agreement_rebate.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/agreement_rebate/tests/test_agreement_rebate.py b/agreement_rebate/tests/test_agreement_rebate.py index 5c6cbf85..796c3f65 100644 --- a/agreement_rebate/tests/test_agreement_rebate.py +++ b/agreement_rebate/tests/test_agreement_rebate.py @@ -15,6 +15,15 @@ class TestAgreementRebate(TransactionCase): def setUpClass(cls): super().setUpClass() cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + if not cls.env.company.chart_template_id: + # Load a CoA if there's none in current company + coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False) + if not coa: + # Load the first available CoA + coa = cls.env["account.chart.template"].search( + [("visible", "=", True)], limit=1 + ) + coa.try_loading(company=cls.env.company, install_demo=False) cls.Partner = cls.env["res.partner"] cls.ProductTemplate = cls.env["product.template"] cls.Product = cls.env["product.product"] @@ -351,7 +360,7 @@ def test_create_settlement_products_filters_section_prorated(self): def _create_invoice_wizard(self): sale_journal = self.env["account.journal"].search( - [("type", "=", "sale")], limit=1 + [("type", "=", "sale"), ("company_id", "=", self.env.company.id)], limit=1 ) wiz_create_invoice_form = Form(self.env["agreement.invoice.create.wiz"]) wiz_create_invoice_form.date_from = "2022-01-01" From 67e75e6c85abfb47db5778fa99c2ee3dcafe55ea Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 25 Feb 2025 14:50:21 +0000 Subject: [PATCH 2/2] [BOT] post-merge updates --- README.md | 2 +- agreement_rebate/README.rst | 2 +- agreement_rebate/__manifest__.py | 2 +- agreement_rebate/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fe6d049d..fbb7e0e2 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ addon | version | maintainers | summary [agreement](agreement/) | 16.0.1.0.0 | [![ygol](https://github.com/ygol.png?size=30px)](https://github.com/ygol) [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Adds an agreement object [agreement_legal](agreement_legal/) | 16.0.2.0.0 | [![max3903](https://github.com/max3903.png?size=30px)](https://github.com/max3903) [![ygol](https://github.com/ygol.png?size=30px)](https://github.com/ygol) | Manage Agreements, LOI and Contracts [agreement_maintenance](agreement_maintenance/) | 16.0.1.0.0 | [![max3903](https://github.com/max3903.png?size=30px)](https://github.com/max3903) | Manage maintenance agreements and contracts -[agreement_rebate](agreement_rebate/) | 16.0.1.0.2 | | Rebate in agreements +[agreement_rebate](agreement_rebate/) | 16.0.1.0.3 | | Rebate in agreements [agreement_sale](agreement_sale/) | 16.0.1.0.0 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) [![bealdav](https://github.com/bealdav.png?size=30px)](https://github.com/bealdav) | Agreement on sales [agreement_serviceprofile](agreement_serviceprofile/) | 16.0.1.0.0 | [![max3903](https://github.com/max3903.png?size=30px)](https://github.com/max3903) | Adds an Agreement Service Profile object diff --git a/agreement_rebate/README.rst b/agreement_rebate/README.rst index f987f5a4..2814ec55 100644 --- a/agreement_rebate/README.rst +++ b/agreement_rebate/README.rst @@ -7,7 +7,7 @@ Agreement Rebate !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:419b7a445fcf32bb25821df4132a08a234b1831ea2ec73d4599bf233339deaad + !! source digest: sha256:dfc793748aea89ff8817253068a09ce884151aaae119d67de0b8df0e7b450c44 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/agreement_rebate/__manifest__.py b/agreement_rebate/__manifest__.py index fe470278..13f361c4 100644 --- a/agreement_rebate/__manifest__.py +++ b/agreement_rebate/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Agreement Rebate", "summary": "Rebate in agreements", - "version": "16.0.1.0.2", + "version": "16.0.1.0.3", "development_status": "Beta", "category": "Agreement", "website": "https://github.com/OCA/agreement", diff --git a/agreement_rebate/static/description/index.html b/agreement_rebate/static/description/index.html index d41bda1e..85da4a92 100644 --- a/agreement_rebate/static/description/index.html +++ b/agreement_rebate/static/description/index.html @@ -367,7 +367,7 @@

Agreement Rebate

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:419b7a445fcf32bb25821df4132a08a234b1831ea2ec73d4599bf233339deaad +!! source digest: sha256:dfc793748aea89ff8817253068a09ce884151aaae119d67de0b8df0e7b450c44 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/agreement Translate me on Weblate Try me on Runboat

This module extends the functionality of agreement module to allow define