mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
@@ -6,8 +6,7 @@ from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def set_default_initiating_party(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
for company in env["res.company"].search([]):
|
||||
company._default_initiating_party()
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
for company in env["res.company"].search([]):
|
||||
company._default_initiating_party()
|
||||
return
|
||||
|
||||
@@ -5,21 +5,20 @@ from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def update_bank_journals(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ajo = env["account.journal"]
|
||||
journals = ajo.search([("type", "=", "bank")])
|
||||
sct = env.ref("account_banking_sepa_credit_transfer.sepa_credit_transfer")
|
||||
if sct:
|
||||
journals.write(
|
||||
{
|
||||
"outbound_payment_method_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{"payment_method_id": sct.id, "name": "SEPA Direct Credit"},
|
||||
)
|
||||
]
|
||||
}
|
||||
)
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ajo = env["account.journal"]
|
||||
journals = ajo.search([("type", "=", "bank")])
|
||||
sct = env.ref("account_banking_sepa_credit_transfer.sepa_credit_transfer")
|
||||
if sct:
|
||||
journals.write(
|
||||
{
|
||||
"outbound_payment_method_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{"payment_method_id": sct.id, "name": "SEPA Direct Credit"},
|
||||
)
|
||||
]
|
||||
}
|
||||
)
|
||||
return
|
||||
|
||||
@@ -5,21 +5,20 @@ from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def update_bank_journals(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ajo = env["account.journal"]
|
||||
journals = ajo.search([("type", "=", "bank")])
|
||||
sdd = env.ref("account_banking_sepa_direct_debit.sepa_direct_debit")
|
||||
if sdd:
|
||||
journals.write(
|
||||
{
|
||||
"inbound_payment_method_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{"payment_method_id": sdd.id, "name": "SEPA Direct Debit"},
|
||||
)
|
||||
]
|
||||
}
|
||||
)
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ajo = env["account.journal"]
|
||||
journals = ajo.search([("type", "=", "bank")])
|
||||
sdd = env.ref("account_banking_sepa_direct_debit.sepa_direct_debit")
|
||||
if sdd:
|
||||
journals.write(
|
||||
{
|
||||
"inbound_payment_method_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{"payment_method_id": sdd.id, "name": "SEPA Direct Debit"},
|
||||
)
|
||||
]
|
||||
}
|
||||
)
|
||||
return
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from odoo.tests import tagged
|
||||
|
||||
from odoo.addons.account.models.account_payment_method import AccountPaymentMethod
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
|
||||
|
||||
@tagged("-at_install", "post_install")
|
||||
class TestAccountPayment(AccountTestInvoicingCommon):
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
@@ -62,6 +65,7 @@ class TestAccountPayment(AccountTestInvoicingCommon):
|
||||
)
|
||||
# Journals
|
||||
cls.manual_in = cls.env.ref("account.account_payment_method_manual_in")
|
||||
cls.sepa_in = cls.env.ref("account_banking_sepa_direct_debit.sepa_direct_debit")
|
||||
cls.manual_out = cls.env.ref("account.account_payment_method_manual_out")
|
||||
|
||||
cls.bank_journal = cls.company_data["default_journal_bank"]
|
||||
@@ -78,6 +82,7 @@ class TestAccountPayment(AccountTestInvoicingCommon):
|
||||
self.assertTrue(self.inbound_payment_method_01.payment_order_only)
|
||||
self.assertTrue(self.inbound_payment_method_02.payment_order_only)
|
||||
self.manual_in.payment_order_only = True
|
||||
self.sepa_in.payment_order_only = True
|
||||
self.assertTrue(self.bank_journal.inbound_payment_order_only)
|
||||
|
||||
def test_account_payment_02(self):
|
||||
@@ -145,6 +150,7 @@ class TestAccountPayment(AccountTestInvoicingCommon):
|
||||
self.assertTrue(self.inbound_payment_method_01.payment_order_only)
|
||||
self.assertTrue(self.inbound_payment_method_02.payment_order_only)
|
||||
self.manual_in.payment_order_only = True
|
||||
self.sepa_in.payment_order_only = True
|
||||
self.assertTrue(self.bank_journal.inbound_payment_order_only)
|
||||
# check journals
|
||||
journals = new_account_payment._get_default_journal()
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
from datetime import date, timedelta
|
||||
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tests import tagged
|
||||
from odoo.tests.common import Form
|
||||
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
|
||||
|
||||
@tagged("-at_install", "post_install")
|
||||
class TestPaymentOrderInboundBase(AccountTestInvoicingCommon):
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
@@ -77,6 +79,7 @@ class TestPaymentOrderInboundBase(AccountTestInvoicingCommon):
|
||||
return invoice_form.save()
|
||||
|
||||
|
||||
@tagged("-at_install", "post_install")
|
||||
class TestPaymentOrderInbound(TestPaymentOrderInboundBase):
|
||||
def test_constrains_type(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
|
||||
@@ -6,10 +6,12 @@ from datetime import date, datetime, timedelta
|
||||
|
||||
from odoo import fields
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tests import tagged
|
||||
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
|
||||
|
||||
@tagged("-at_install", "post_install")
|
||||
class TestPaymentOrderOutbound(AccountTestInvoicingCommon):
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
|
||||
@@ -34,6 +34,7 @@ class TestAccountPaymentPartner(TransactionCase):
|
||||
raise ValidationError(_("No Chart of Account Template has been defined !"))
|
||||
old_company = cls.env.user.company_id
|
||||
cls.env.user.company_id = cls.company_2.id
|
||||
cls.env.ref("base.user_admin").company_ids = [(4, cls.company_2.id)]
|
||||
cls.chart.try_loading()
|
||||
cls.env.user.company_id = old_company.id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user