mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] contract_payment_mode: Migration to 16.0
This commit is contained in:
@@ -4,12 +4,13 @@
|
|||||||
# Copyright 2017 Tecnativa - Carlos Dauden <carlos.dauden@tecnativa.com>
|
# Copyright 2017 Tecnativa - Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
# Copyright 2017-2018 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
|
# Copyright 2017-2018 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
|
||||||
# Copyright (C) 2021 Open Source Integrators
|
# Copyright (C) 2021 Open Source Integrators
|
||||||
|
# Copyright 2023 Tecnativa - Carolina Fernandez
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Contract Payment Mode",
|
"name": "Contract Payment Mode",
|
||||||
"summary": "Payment mode in contracts and their invoices",
|
"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)",
|
"author": "Domatix, " "Tecnativa, " "Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/contract",
|
"website": "https://github.com/OCA/contract",
|
||||||
"depends": ["contract", "account_payment_partner"],
|
"depends": ["contract", "account_payment_partner"],
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ class ContractContract(models.Model):
|
|||||||
self.payment_mode_id = partner.customer_payment_mode_id.id
|
self.payment_mode_id = partner.customer_payment_mode_id.id
|
||||||
|
|
||||||
def _prepare_invoice(self, date_invoice, journal=None):
|
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
|
date_invoice=date_invoice, journal=journal
|
||||||
)
|
)
|
||||||
if self.payment_mode_id:
|
if self.payment_mode_id:
|
||||||
invoice_vals["payment_mode_id"] = self.payment_mode_id.id
|
invoice_vals["payment_mode_id"] = self.payment_mode_id.id
|
||||||
return invoice_vals, move_form
|
return invoice_vals
|
||||||
|
|||||||
@@ -5,3 +5,4 @@
|
|||||||
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
* Guillermo Llinares <guillermo@studio73.es>
|
* Guillermo Llinares <guillermo@studio73.es>
|
||||||
* Amamr Officewala <aofficewala@opensourceintegrators.com>
|
* Amamr Officewala <aofficewala@opensourceintegrators.com>
|
||||||
|
* Carolina Fernandez <carolina.fernandez@tecnativa.com>
|
||||||
|
|||||||
@@ -431,6 +431,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|||||||
<li>Carlos Dauden <<a class="reference external" href="mailto:carlos.dauden@tecnativa.com">carlos.dauden@tecnativa.com</a>></li>
|
<li>Carlos Dauden <<a class="reference external" href="mailto:carlos.dauden@tecnativa.com">carlos.dauden@tecnativa.com</a>></li>
|
||||||
<li>Guillermo Llinares <<a class="reference external" href="mailto:guillermo@studio73.es">guillermo@studio73.es</a>></li>
|
<li>Guillermo Llinares <<a class="reference external" href="mailto:guillermo@studio73.es">guillermo@studio73.es</a>></li>
|
||||||
<li>Amamr Officewala <<a class="reference external" href="mailto:aofficewala@opensourceintegrators.com">aofficewala@opensourceintegrators.com</a>></li>
|
<li>Amamr Officewala <<a class="reference external" href="mailto:aofficewala@opensourceintegrators.com">aofficewala@opensourceintegrators.com</a>></li>
|
||||||
|
<li>Carolina Fernandez <<a class="reference external" href="mailto:carolina.fernandez@tecnativa.com">carolina.fernandez@tecnativa.com</a>></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa
|
# Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||||
# Copyright 2017 Tecnativa - Vicent Cubells
|
# Copyright 2017 Tecnativa - Vicent Cubells
|
||||||
# Copyright 2017 Tecnativa - David Vidal
|
# Copyright 2017 Tecnativa - David Vidal
|
||||||
|
# Copyright 2023 Tecnativa - Carolina Fernandez
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
@@ -15,8 +16,9 @@ from ..hooks import post_init_hook
|
|||||||
|
|
||||||
@tagged("post_install", "-at_install")
|
@tagged("post_install", "-at_install")
|
||||||
class TestContractPaymentInit(odoo.tests.HttpCase):
|
class TestContractPaymentInit(odoo.tests.HttpCase):
|
||||||
def setUp(self):
|
@classmethod
|
||||||
super().setUp()
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
|
|
||||||
Method_get_payment_method_information = (
|
Method_get_payment_method_information = (
|
||||||
AccountPaymentMethod._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",
|
||||||
_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",
|
"name": "Test Payment Method",
|
||||||
"code": "Test",
|
"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",
|
"name": "Test payment mode",
|
||||||
"active": True,
|
"active": True,
|
||||||
"payment_method_id": self.payment_method.id,
|
"payment_method_id": cls.payment_method.id,
|
||||||
"bank_account_link": "variable",
|
"bank_account_link": "variable",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.partner = self.env["res.partner"].create(
|
cls.partner = cls.env["res.partner"].create(
|
||||||
{
|
{
|
||||||
"name": "Test contract partner",
|
"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",
|
"name": "Custom Service",
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"uom_id": self.env.ref("uom.product_uom_hour").id,
|
"uom_id": cls.env.ref("uom.product_uom_hour").id,
|
||||||
"uom_po_id": self.env.ref("uom.product_uom_hour").id,
|
"uom_po_id": cls.env.ref("uom.product_uom_hour").id,
|
||||||
"sale_ok": True,
|
"sale_ok": True,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.contract = self.env["contract.contract"].create(
|
cls.contract = cls.env["contract.contract"].create(
|
||||||
{"name": "Maintenance of Servers", "partner_id": self.partner.id}
|
{"name": "Maintenance of Servers", "partner_id": cls.partner.id}
|
||||||
)
|
)
|
||||||
company = self.env.ref("base.main_company")
|
company = cls.env.ref("base.main_company")
|
||||||
self.journal = self.env["account.journal"].create(
|
cls.journal = cls.env["account.journal"].create(
|
||||||
{
|
{
|
||||||
"name": "Sale Journal - Test",
|
"name": "Sale Journal - Test",
|
||||||
"code": "HRTSJ",
|
"code": "HRTSJ",
|
||||||
|
|||||||
Reference in New Issue
Block a user