From f9e9aaf6aa6171e23c7c0e6009ea412088ee5e4b Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Wed, 14 Apr 2021 11:42:27 +0200 Subject: [PATCH] [13.0][FIX] l10n_ch_base_bank (#603) * [13.0][FIX] l10n_ch_base_bank On an unrelated PR the test for l10n_ch_base_bank were broken. It seems to be related to this new change introduced by * https://github.com/odoo/odoo/pull/67599 Which test the valid of the type journal. So this fixes the test, but I am not sure if they are still meaningfull. --- .../tests/test_create_invoice.py | 23 +++++++++++-------- .../tests/test_search_invoice.py | 11 +++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/l10n_ch_base_bank/tests/test_create_invoice.py b/l10n_ch_base_bank/tests/test_create_invoice.py index 0e5387aa7..aa48143b1 100644 --- a/l10n_ch_base_bank/tests/test_create_invoice.py +++ b/l10n_ch_base_bank/tests/test_create_invoice.py @@ -14,20 +14,25 @@ def setUpClass(cls): bank = cls.env["res.bank"].create( {"name": "BCV", "bic": "BBRUBEBB", "clearing": "234234"} ) - # define company bank account - cls.bank_journal = cls.env["account.journal"].create( + cls.env["res.partner.bank"].create( { + "partner_id": cls.company.partner_id.id, + "bank_id": bank.id, + "acc_number": "ISR", + "l10n_ch_isr_subscription_chf": "01-162-8", + "sequence": 1, + } + ) + cls.journal = cls.env["account.journal"].create( + { + "name": "Test Sale Journal", "company_id": cls.company.id, - "type": "bank", - "code": "BNK42", + "type": "sale", + "code": "SALE123", "bank_id": bank.id, "bank_acc_number": "01-1234-1", } ) - cls.bank_acc = cls.bank_journal.bank_account_id - cls.bank_acc.write({"l10n_ch_isr_subscription_chf": "01-162-8", "sequence": 1}) - fields_list = ["company_id", "user_id", "currency_id", "journal_id"] - cls.inv_values = cls.env["account.move"].default_get(fields_list) def new_form(self): inv = Form( @@ -38,7 +43,7 @@ def new_form(self): # view='account.view_move_form' # ) inv.partner_id = self.partner - inv.journal_id = self.bank_journal + inv.journal_id = self.journal return inv def test_emit_move_with_isr_ref(self): diff --git a/l10n_ch_base_bank/tests/test_search_invoice.py b/l10n_ch_base_bank/tests/test_search_invoice.py index c1bdcd5cf..4fb1363be 100644 --- a/l10n_ch_base_bank/tests/test_search_invoice.py +++ b/l10n_ch_base_bank/tests/test_search_invoice.py @@ -12,6 +12,7 @@ def setUpClass(cls): super().setUpClass() cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) cls.company = cls.env.ref("base.main_company") + cls.partner = cls.env.ref("base.res_partner_12") bank = cls.env["res.bank"].create( {"name": "BCV", "bic": "BBRUBEBB", "clearing": "234234"} ) @@ -24,12 +25,12 @@ def setUpClass(cls): "sequence": 1, } ) - cls.partner = cls.env["res.partner"].create({"name": "Test"}) - cls.bank_journal = cls.env["account.journal"].create( + cls.journal = cls.env["account.journal"].create( { + "name": "Test Journal", "company_id": cls.company.id, - "type": "bank", - "code": "BNK42", + "type": "sale", + "code": "SALE123", "bank_id": bank.id, "bank_acc_number": "10-8060-7", } @@ -42,7 +43,7 @@ def new_form(self): # view='account.view_move_form' # ) inv.partner_id = self.partner - inv.journal_id = self.bank_journal + inv.journal_id = self.journal return inv def assert_find_ref(self, ref, operator, value):