Skip to content

Commit

Permalink
[MIG] contract_payment_mode: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandez-tecnativa committed Oct 3, 2023
1 parent d56133e commit 1547e20
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion contract_payment_mode/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# Copyright 2017 Tecnativa - Carlos Dauden <[email protected]>
# Copyright 2017-2018 Tecnativa - Vicent Cubells <[email protected]>
# 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"],
Expand Down
4 changes: 2 additions & 2 deletions contract_payment_mode/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions contract_payment_mode/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
* Carlos Dauden <[email protected]>
* Guillermo Llinares <[email protected]>
* Amamr Officewala <[email protected]>
* Carolina Fernandez <[email protected]>
1 change: 1 addition & 0 deletions contract_payment_mode/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<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">
Expand Down
30 changes: 16 additions & 14 deletions contract_payment_mode/tests/test_contract_payment.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -32,42 +34,42 @@ 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",
"payment_type": "inbound",
}
)

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",
Expand Down

0 comments on commit 1547e20

Please sign in to comment.