From aa7c3cc7faffc2cec54be32850b55e466287f26b Mon Sep 17 00:00:00 2001 From: Carolina Fernandez Date: Tue, 10 Oct 2023 09:09:36 -0300 Subject: [PATCH] [MIG] contract_sale_invoicing: Migration to 15.0 TT45293 Co-Authored-By: Pedro M. Baeza --- contract_sale_invoicing/README.rst | 14 ++++++++------ contract_sale_invoicing/__init__.py | 1 - contract_sale_invoicing/__manifest__.py | 3 ++- .../i18n/contract_sale_invoicing.pot | 11 ++++++----- contract_sale_invoicing/models/contract.py | 7 ++----- .../readme/CONTRIBUTORS.rst | 2 ++ .../static/description/index.html | 10 ++++++---- .../tests/test_contract_sale_invoicing.py | 18 ++++++++++++++++-- 8 files changed, 42 insertions(+), 24 deletions(-) diff --git a/contract_sale_invoicing/README.rst b/contract_sale_invoicing/README.rst index 03c32fb19..348b23b1d 100644 --- a/contract_sale_invoicing/README.rst +++ b/contract_sale_invoicing/README.rst @@ -7,7 +7,7 @@ Contract Invoicing of Pending Sales Orders !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:677f350039713fce998708f88a5907a26cde8dac2595c5f0e5d78af8c31a3c9f + !! source digest: sha256:2b2b2e531417f29b197fed649fe83609b1f0277ad1946cd51d1dc644c2e30479 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Contract Invoicing of Pending Sales Orders :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github - :target: https://github.com/OCA/contract/tree/12.0/contract_sale_invoicing + :target: https://github.com/OCA/contract/tree/15.0/contract_sale_invoicing :alt: OCA/contract .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract_sale_invoicing + :target: https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract_sale_invoicing :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=12.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=15.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -55,7 +55,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -73,6 +73,8 @@ Contributors * `Tecnativa `_: * Carlos Dauden + * Carolina Fernandez + * Pedro M. Baeza * Souheil Bejaoui Maintainers @@ -88,6 +90,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/contract `_ project on GitHub. +This module is part of the `OCA/contract `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_sale_invoicing/__init__.py b/contract_sale_invoicing/__init__.py index c7818ff10..31660d6a9 100644 --- a/contract_sale_invoicing/__init__.py +++ b/contract_sale_invoicing/__init__.py @@ -1,4 +1,3 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import models -from . import tests diff --git a/contract_sale_invoicing/__manifest__.py b/contract_sale_invoicing/__manifest__.py index cbd303fe3..76aa1d503 100644 --- a/contract_sale_invoicing/__manifest__.py +++ b/contract_sale_invoicing/__manifest__.py @@ -1,9 +1,10 @@ # Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2023 Tecnativa - Carolina Fernandez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Contract Invoicing of Pending Sales Orders", "summary": "Include sales to invoice in contract invoice creation", - "version": "12.0.1.0.4", + "version": "15.0.1.0.0", "category": "Contract Management", "website": "https://github.com/OCA/contract", "author": "Tecnativa, " "Odoo Community Association (OCA)", diff --git a/contract_sale_invoicing/i18n/contract_sale_invoicing.pot b/contract_sale_invoicing/i18n/contract_sale_invoicing.pot index d79693b0c..e4abeaa34 100644 --- a/contract_sale_invoicing/i18n/contract_sale_invoicing.pot +++ b/contract_sale_invoicing/i18n/contract_sale_invoicing.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * contract_sale_invoicing +# * contract_sale_invoicing # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -20,11 +20,12 @@ msgstr "" #. module: contract_sale_invoicing #: model:ir.model.fields,help:contract_sale_invoicing.field_contract_contract__invoicing_sales -msgid "If checked include sales with same analytic account to invoice in contract invoice creation." +msgid "" +"If checked include sales with same analytic account to invoice in contract " +"invoice creation." msgstr "" #. module: contract_sale_invoicing #: model:ir.model.fields,field_description:contract_sale_invoicing.field_contract_contract__invoicing_sales msgid "Invoice Pending Sales Orders" msgstr "" - diff --git a/contract_sale_invoicing/models/contract.py b/contract_sale_invoicing/models/contract.py index 2cb5c427f..cabdaaaae 100644 --- a/contract_sale_invoicing/models/contract.py +++ b/contract_sale_invoicing/models/contract.py @@ -1,7 +1,7 @@ # Copyright 2018 Tecnativa - Carlos Dauden # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import fields, models class ContractContract(models.Model): @@ -13,7 +13,6 @@ class ContractContract(models.Model): "in contract invoice creation.", ) - @api.multi def _recurring_create_invoice(self, date_ref=False): invoices = super()._recurring_create_invoice(date_ref) for contract in self: @@ -36,7 +35,5 @@ class ContractContract(models.Model): ] ) if sales: - invoice_ids = sales.action_invoice_create() - invoices |= self.env["account.invoice"].browse(invoice_ids)[:1] - + invoices |= sales._create_invoices() return invoices diff --git a/contract_sale_invoicing/readme/CONTRIBUTORS.rst b/contract_sale_invoicing/readme/CONTRIBUTORS.rst index 0f1979501..f47d6e5bb 100644 --- a/contract_sale_invoicing/readme/CONTRIBUTORS.rst +++ b/contract_sale_invoicing/readme/CONTRIBUTORS.rst @@ -1,4 +1,6 @@ * `Tecnativa `_: * Carlos Dauden + * Carolina Fernandez + * Pedro M. Baeza * Souheil Bejaoui diff --git a/contract_sale_invoicing/static/description/index.html b/contract_sale_invoicing/static/description/index.html index 15b5c24f4..644b091ff 100644 --- a/contract_sale_invoicing/static/description/index.html +++ b/contract_sale_invoicing/static/description/index.html @@ -367,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:677f350039713fce998708f88a5907a26cde8dac2595c5f0e5d78af8c31a3c9f +!! source digest: sha256:2b2b2e531417f29b197fed649fe83609b1f0277ad1946cd51d1dc644c2e30479 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This modules allows to include on the same invoice than the recurring invoice contract, all the pending to invoice sales orders that you have with the same analytic account.

@@ -403,7 +403,7 @@ generated.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -419,6 +419,8 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Tecnativa:
    • Carlos Dauden
    • +
    • Carolina Fernandez
    • +
    • Pedro M. Baeza
  • Souheil Bejaoui <souheil.bejaoui@acsone.eu>
  • @@ -431,7 +433,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/contract project on GitHub.

    +

    This module is part of the OCA/contract project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/contract_sale_invoicing/tests/test_contract_sale_invoicing.py b/contract_sale_invoicing/tests/test_contract_sale_invoicing.py index e9eb68f64..f0b7a83c7 100644 --- a/contract_sale_invoicing/tests/test_contract_sale_invoicing.py +++ b/contract_sale_invoicing/tests/test_contract_sale_invoicing.py @@ -1,13 +1,28 @@ # Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2023 Tecnativa - Carolina Fernandez +# Copyright 2023 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from freezegun import freeze_time + from odoo.addons.contract.tests.test_contract import TestContractBase +@freeze_time("2016-02-28") class TestContractSaleInvoicing(TestContractBase): @classmethod def setUpClass(cls): - super(TestContractSaleInvoicing, cls).setUpClass() + super().setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) cls.contract.group_id = cls.env["account.analytic.account"].search([], limit=1) cls.product_so = cls.env.ref("product.product_product_1") cls.product_so.invoice_policy = "order" @@ -31,7 +46,6 @@ class TestContractSaleInvoicing(TestContractBase): ], "pricelist_id": cls.partner.property_product_pricelist.id, "analytic_account_id": cls.contract.group_id.id, - "date_order": "2016-02-15", } )