[MIG] contract_payment_mode: Migration to 16.0

This commit is contained in:
Carolina Fernandez
2023-10-03 07:13:01 -03:00
parent d56133e70c
commit 1547e208c2
5 changed files with 22 additions and 17 deletions

View File

@@ -4,12 +4,13 @@
# Copyright 2017 Tecnativa - Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2017-2018 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
# 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"],

View File

@@ -20,9 +20,9 @@ class ContractContract(models.Model):
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

View File

@@ -5,3 +5,4 @@
* Carlos Dauden <carlos.dauden@tecnativa.com>
* Guillermo Llinares <guillermo@studio73.es>
* Amamr Officewala <aofficewala@opensourceintegrators.com>
* Carolina Fernandez <carolina.fernandez@tecnativa.com>

View File

@@ -431,6 +431,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Carlos Dauden &lt;<a class="reference external" href="mailto:carlos.dauden&#64;tecnativa.com">carlos.dauden&#64;tecnativa.com</a>&gt;</li>
<li>Guillermo Llinares &lt;<a class="reference external" href="mailto:guillermo&#64;studio73.es">guillermo&#64;studio73.es</a>&gt;</li>
<li>Amamr Officewala &lt;<a class="reference external" href="mailto:aofficewala&#64;opensourceintegrators.com">aofficewala&#64;opensourceintegrators.com</a>&gt;</li>
<li>Carolina Fernandez &lt;<a class="reference external" href="mailto:carolina.fernandez&#64;tecnativa.com">carolina.fernandez&#64;tecnativa.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">

View File

@@ -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 @@ from ..hooks import post_init_hook
@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 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
"_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 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
}
)
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",