Skip to content

Commit

Permalink
[MIG] contract_payment_mode: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
palkesh-aktivsoftware committed Mar 28, 2022
1 parent baef3eb commit 7c7f40b
Show file tree
Hide file tree
Showing 30 changed files with 74 additions and 96 deletions.
2 changes: 1 addition & 1 deletion contract_payment_mode/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"name": "Contract Payment Mode",
"summary": "Payment mode in contracts and their invoices",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"author": "Domatix, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/contract",
"depends": ["contract", "account_payment_partner"],
Expand Down
22 changes: 11 additions & 11 deletions contract_payment_mode/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

def post_init_hook(cr, registry):
"""Copy payment mode from partner to the new field at contract."""
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
m_contract = env["contract.contract"]
contracts = m_contract.search([("payment_mode_id", "=", False)])
if contracts:
_logger.info("Setting payment mode: %d contracts" % len(contracts))
for contract in contracts:
payment_mode = contract.partner_id.customer_payment_mode_id
if payment_mode:
contract.payment_mode_id = payment_mode.id
_logger.info("Setting payment mode: Done")
# with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
m_contract = env["contract.contract"]
contracts = m_contract.search([("payment_mode_id", "=", False)])
if contracts:
_logger.info("Setting payment mode: %d contracts" % len(contracts))
for contract in contracts:
payment_mode = contract.partner_id.customer_payment_mode_id
if payment_mode:
contract.payment_mode_id = payment_mode.id
_logger.info("Setting payment mode: Done")
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Marc Tormo i Bochaca <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2019-10-09 18:37+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/contract_payment_mode.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2019-10-29 21:33+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/el_GR.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Project-Id-Version: contract (15.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2015-11-07 12:33+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
42 changes: 0 additions & 42 deletions contract_payment_mode/i18n/es_AR.po

This file was deleted.

2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/es_MX.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Project-Id-Version: contract (15.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2015-11-07 12:33+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/gl.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/hi_IN.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Ashish Deshmukh <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-08-17 01:05+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Bole <[email protected]>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2018-02-10 03:15+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/hr_HR.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Bole <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-06-17 01:39+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
11 changes: 5 additions & 6 deletions contract_payment_mode/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
# Stefano <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2022-03-27 00:17+0000\n"
"Last-Translator: Andrea Cometa <[email protected]>\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
"Last-Translator: Stefano <[email protected]>, 2017\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: contract_payment_mode
#: model:ir.model,name:contract_payment_mode.model_contract_contract
msgid "Contract"
msgstr "Contratto"
msgstr ""

#. module: contract_payment_mode
#: model:ir.model.fields,field_description:contract_payment_mode.field_contract_contract__payment_mode_id
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Erwin van der Ploeg <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Pedro Castro Silva <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2020-02-17 19:13+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2019-10-10 20:36+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/pt_PT.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Daniel Reis <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/ro.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# nek, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2018-03-17 03:26+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/sk_SK.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (8.0)\n"
"Project-Id-Version: contract (15.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2015-11-07 12:33+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Ediz Duman <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-06-13 02:40+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/tr_TR.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Ediz Duman <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2017-06-13 02:40+0000\n"
Expand Down
2 changes: 1 addition & 1 deletion contract_payment_mode/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ITGeeker <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 15.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-29 10:30+0000\n"
"PO-Revision-Date: 2019-10-16 18:31+0000\n"
Expand Down
27 changes: 25 additions & 2 deletions contract_payment_mode/tests/test_contract_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
# Copyright 2017 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from unittest.mock import patch

import odoo.tests
from odoo.tests import tagged

from odoo.addons.account.models.account_payment_method import AccountPaymentMethod

from ..hooks import post_init_hook


Expand All @@ -14,9 +18,28 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
def setUp(self):
super().setUp()

self.payment_method = self.env["account.payment.method"].create(
{"name": "Test Payment Method", "code": "Test", "payment_type": "inbound"}
Method_get_payment_method_information = (
AccountPaymentMethod._get_payment_method_information
)

def _get_payment_method_information(self):
res = Method_get_payment_method_information(self)
res["Test"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
return res

with patch.object(
AccountPaymentMethod,
"_get_payment_method_information",
_get_payment_method_information,
):
self.payment_method = self.env["account.payment.method"].create(
{
"name": "Test Payment Method",
"code": "Test",
"payment_type": "inbound",
}
)

self.payment_mode = self.env["account.payment.mode"].create(
{
"name": "Test payment mode",
Expand Down
Loading

0 comments on commit 7c7f40b

Please sign in to comment.