From 1547e208c2007cc01301dadc984fe4789310fcf3 Mon Sep 17 00:00:00 2001 From: Carolina Fernandez Date: Tue, 3 Oct 2023 07:13:01 -0300 Subject: [PATCH] [MIG] contract_payment_mode: Migration to 16.0 --- contract_payment_mode/__manifest__.py | 3 +- contract_payment_mode/models/contract.py | 4 +-- contract_payment_mode/readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 1 + .../tests/test_contract_payment.py | 30 ++++++++++--------- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/contract_payment_mode/__manifest__.py b/contract_payment_mode/__manifest__.py index d7e8ee136c..ec574554df 100644 --- a/contract_payment_mode/__manifest__.py +++ b/contract_payment_mode/__manifest__.py @@ -4,12 +4,13 @@ # Copyright 2017 Tecnativa - Carlos Dauden # Copyright 2017-2018 Tecnativa - Vicent Cubells # Copyright (C) 2021 Open Source Integrators +# Copyright 2023 Tecnativa - Carolina Fernandez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Contract Payment Mode", "summary": "Payment mode in contracts and their invoices", - "version": "15.0.1.1.1", + "version": "16.0.1.0.0", "author": "Domatix, " "Tecnativa, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/contract", "depends": ["contract", "account_payment_partner"], diff --git a/contract_payment_mode/models/contract.py b/contract_payment_mode/models/contract.py index d5c6f6ef92..fdfca18f4d 100644 --- a/contract_payment_mode/models/contract.py +++ b/contract_payment_mode/models/contract.py @@ -20,9 +20,9 @@ def on_change_partner_id(self): self.payment_mode_id = partner.customer_payment_mode_id.id def _prepare_invoice(self, date_invoice, journal=None): - invoice_vals, move_form = super()._prepare_invoice( + invoice_vals = super()._prepare_invoice( date_invoice=date_invoice, journal=journal ) if self.payment_mode_id: invoice_vals["payment_mode_id"] = self.payment_mode_id.id - return invoice_vals, move_form + return invoice_vals diff --git a/contract_payment_mode/readme/CONTRIBUTORS.rst b/contract_payment_mode/readme/CONTRIBUTORS.rst index 1d3cc6dfdf..0690183920 100644 --- a/contract_payment_mode/readme/CONTRIBUTORS.rst +++ b/contract_payment_mode/readme/CONTRIBUTORS.rst @@ -5,3 +5,4 @@ * Carlos Dauden * Guillermo Llinares * Amamr Officewala +* Carolina Fernandez diff --git a/contract_payment_mode/static/description/index.html b/contract_payment_mode/static/description/index.html index 99081d53ec..5a641b2117 100644 --- a/contract_payment_mode/static/description/index.html +++ b/contract_payment_mode/static/description/index.html @@ -431,6 +431,7 @@

Contributors

  • Carlos Dauden <carlos.dauden@tecnativa.com>
  • Guillermo Llinares <guillermo@studio73.es>
  • Amamr Officewala <aofficewala@opensourceintegrators.com>
  • +
  • Carolina Fernandez <carolina.fernandez@tecnativa.com>
  • diff --git a/contract_payment_mode/tests/test_contract_payment.py b/contract_payment_mode/tests/test_contract_payment.py index 100b3dad98..3c91628d74 100644 --- a/contract_payment_mode/tests/test_contract_payment.py +++ b/contract_payment_mode/tests/test_contract_payment.py @@ -1,6 +1,7 @@ # Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa # Copyright 2017 Tecnativa - Vicent Cubells # Copyright 2017 Tecnativa - David Vidal +# Copyright 2023 Tecnativa - Carolina Fernandez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from unittest.mock import patch @@ -15,8 +16,9 @@ @tagged("post_install", "-at_install") class TestContractPaymentInit(odoo.tests.HttpCase): - def setUp(self): - super().setUp() + @classmethod + def setUpClass(cls): + super().setUpClass() Method_get_payment_method_information = ( AccountPaymentMethod._get_payment_method_information @@ -32,7 +34,7 @@ def _get_payment_method_information(self): "_get_payment_method_information", _get_payment_method_information, ): - self.payment_method = self.env["account.payment.method"].create( + cls.payment_method = cls.env["account.payment.method"].create( { "name": "Test Payment Method", "code": "Test", @@ -40,34 +42,34 @@ def _get_payment_method_information(self): } ) - self.payment_mode = self.env["account.payment.mode"].create( + cls.payment_mode = cls.env["account.payment.mode"].create( { "name": "Test payment mode", "active": True, - "payment_method_id": self.payment_method.id, + "payment_method_id": cls.payment_method.id, "bank_account_link": "variable", } ) - self.partner = self.env["res.partner"].create( + cls.partner = cls.env["res.partner"].create( { "name": "Test contract partner", - "customer_payment_mode_id": self.payment_mode, + "customer_payment_mode_id": cls.payment_mode, } ) - self.product = self.env["product.product"].create( + cls.product = cls.env["product.product"].create( { "name": "Custom Service", "type": "service", - "uom_id": self.env.ref("uom.product_uom_hour").id, - "uom_po_id": self.env.ref("uom.product_uom_hour").id, + "uom_id": cls.env.ref("uom.product_uom_hour").id, + "uom_po_id": cls.env.ref("uom.product_uom_hour").id, "sale_ok": True, } ) - self.contract = self.env["contract.contract"].create( - {"name": "Maintenance of Servers", "partner_id": self.partner.id} + cls.contract = cls.env["contract.contract"].create( + {"name": "Maintenance of Servers", "partner_id": cls.partner.id} ) - company = self.env.ref("base.main_company") - self.journal = self.env["account.journal"].create( + company = cls.env.ref("base.main_company") + cls.journal = cls.env["account.journal"].create( { "name": "Sale Journal - Test", "code": "HRTSJ",