From 6ab34e532bab514593a24fe4990561f5ad1f71be Mon Sep 17 00:00:00 2001
From: Vladimir Mitreski
Date: Tue, 17 May 2022 12:44:45 +0200
Subject: [PATCH] [FIX] account_payment_purchase: Make payment method to
require bank account
Without this fix, the partner_bank_id was being reset to False on change of 'company_id'
in the _onchange_purchase_auto_complete method in account.move in the following unit test:
def test_from_purchase_order_invoicing_bank
That's because in commit 9be9766535e46b53f30de1aa143d92d49bd97acd we switched to
getting payment method from env.ref('account.account_payment_method_manual_out'), which has
bank_account_required == False by default, while before that we were creating payment method for
which we were explicitly setting bank_account_required as True
Also tag unit test as post_install
---
account_payment_purchase/README.rst | 10 +++----
.../i18n/account_payment_purchase.pot | 28 ++++---------------
.../static/description/index.html | 6 ++--
.../tests/test_account_payment_purchase.py | 4 ++-
4 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/account_payment_purchase/README.rst b/account_payment_purchase/README.rst
index b1829004c..cbb05cd7b 100644
--- a/account_payment_purchase/README.rst
+++ b/account_payment_purchase/README.rst
@@ -14,16 +14,16 @@ Account Payment Purchase
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
- :target: https://github.com/OCA/bank-payment/tree/14.0/account_payment_purchase
+ :target: https://github.com/OCA/bank-payment/tree/15.0/account_payment_purchase
:alt: OCA/bank-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_purchase
+ :target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_payment_purchase
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/173/14.0
+ :target: https://runbot.odoo-community.org/runbot/173/15.0
:alt: Try me on Runbot
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds 2 fields on purchase orders: *Bank Account* and *Payment
Mode*. These fields are copied from partner to purchase order and then from
@@ -69,7 +69,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/account_payment_purchase/i18n/account_payment_purchase.pot b/account_payment_purchase/i18n/account_payment_purchase.pot
index a466db856..9c7d4812f 100644
--- a/account_payment_purchase/i18n/account_payment_purchase.pot
+++ b/account_payment_purchase/i18n/account_payment_purchase.pot
@@ -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"
@@ -13,29 +13,11 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: account_payment_purchase
-#: model:ir.model.fields,field_description:account_payment_purchase.field_account_move__display_name
-#: model:ir.model.fields,field_description:account_payment_purchase.field_purchase_order__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: account_payment_purchase
-#: model:ir.model.fields,field_description:account_payment_purchase.field_account_move__id
-#: model:ir.model.fields,field_description:account_payment_purchase.field_purchase_order__id
-msgid "ID"
-msgstr ""
-
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_account_move
msgid "Journal Entry"
msgstr ""
-#. module: account_payment_purchase
-#: model:ir.model.fields,field_description:account_payment_purchase.field_account_move____last_update
-#: model:ir.model.fields,field_description:account_payment_purchase.field_purchase_order____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: account_payment_purchase
#: model:ir.model.fields,field_description:account_payment_purchase.field_purchase_order__payment_mode_id
msgid "Payment Mode"
@@ -55,13 +37,13 @@ msgid ""
msgstr ""
#. module: account_payment_purchase
-#: code:addons/account_payment_purchase/models/account_invoice.py:0
+#: code:addons/account_payment_purchase/models/account_move.py:0
#, python-format
msgid "Selected purchase order have different payment mode."
msgstr ""
#. module: account_payment_purchase
-#: code:addons/account_payment_purchase/models/account_invoice.py:0
+#: code:addons/account_payment_purchase/models/account_move.py:0
#, python-format
msgid "Selected purchase order have different supplier bank."
msgstr ""
@@ -72,8 +54,8 @@ msgid "Supplier Bank Account"
msgstr ""
#. module: account_payment_purchase
-#: code:addons/account_payment_purchase/models/account_invoice.py:0
-#: code:addons/account_payment_purchase/models/account_invoice.py:0
+#: code:addons/account_payment_purchase/models/account_move.py:0
+#: code:addons/account_payment_purchase/models/account_move.py:0
#, python-format
msgid "Warning"
msgstr ""
diff --git a/account_payment_purchase/static/description/index.html b/account_payment_purchase/static/description/index.html
index 5db43ee37..02f1b00d5 100644
--- a/account_payment_purchase/static/description/index.html
+++ b/account_payment_purchase/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module adds 2 fields on purchase orders: Bank Account and Payment
Mode. These fields are copied from partner to purchase order and then from
purchase order to supplier invoice.
@@ -414,7 +414,7 @@ Invoices without any payment mode are displayed too.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -452,7 +452,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/bank-payment project on GitHub.
+
This module is part of the OCA/bank-payment project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_payment_purchase/tests/test_account_payment_purchase.py b/account_payment_purchase/tests/test_account_payment_purchase.py
index 67b65d4ed..07dd5bc43 100644
--- a/account_payment_purchase/tests/test_account_payment_purchase.py
+++ b/account_payment_purchase/tests/test_account_payment_purchase.py
@@ -3,9 +3,10 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import fields
-from odoo.tests import Form, TransactionCase
+from odoo.tests import Form, TransactionCase, tagged
+@tagged("-at_install", "post_install")
class TestAccountPaymentPurchase(TransactionCase):
@classmethod
def setUpClass(cls):
@@ -16,6 +17,7 @@ class TestAccountPaymentPurchase(TransactionCase):
cls.payment_method_out = cls.env.ref(
"account.account_payment_method_manual_out"
)
+ cls.payment_method_out.bank_account_required = True
cls.payment_mode = cls.env["account.payment.mode"].create(
{
"name": "Test payment mode",