mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 03:22:04 +02:00
Initial commit: L10N_Europe packages
This commit is contained in:
commit
9803722600
2377 changed files with 380711 additions and 0 deletions
5
odoo-bringout-oca-ocb-l10n_fi/l10n_fi/tests/__init__.py
Normal file
5
odoo-bringout-oca-ocb-l10n_fi/l10n_fi/tests/__init__.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_references
|
||||
from . import test_get_reference
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install_l10n', 'post_install', '-at_install')
|
||||
class InvoiceGetReferenceTest(AccountTestInvoicingCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref='l10n_fi.fi_chart_template'):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
|
||||
cls.invoice = cls.init_invoice('out_invoice', products=cls.product_a+cls.product_b)
|
||||
|
||||
def test_get_reference_finnish_invoice(self):
|
||||
self.assertFalse(self.invoice.payment_reference)
|
||||
self.invoice.journal_id.invoice_reference_model = 'fi'
|
||||
self.invoice.action_post()
|
||||
self.assertTrue(self.invoice.payment_reference)
|
||||
|
||||
def test_get_reference_finnish_partner(self):
|
||||
self.assertFalse(self.invoice.payment_reference)
|
||||
self.invoice.journal_id.invoice_reference_type = 'partner'
|
||||
self.invoice.journal_id.invoice_reference_model = 'fi'
|
||||
self.invoice.action_post()
|
||||
self.assertTrue(self.invoice.payment_reference)
|
||||
|
||||
def test_get_reference_finnish_rf_invoice(self):
|
||||
self.assertFalse(self.invoice.payment_reference)
|
||||
self.invoice.journal_id.invoice_reference_model = 'fi_rf'
|
||||
self.invoice.action_post()
|
||||
self.assertTrue(self.invoice.payment_reference)
|
||||
|
||||
def test_get_reference_finnish_rf_partner(self):
|
||||
self.assertFalse(self.invoice.payment_reference)
|
||||
self.invoice.journal_id.invoice_reference_type = 'partner'
|
||||
self.invoice.journal_id.invoice_reference_model = 'fi_rf'
|
||||
self.invoice.action_post()
|
||||
self.assertTrue(self.invoice.payment_reference)
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo.tests import tagged
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@tagged('post_install_l10n', 'post_install', '-at_install')
|
||||
class PaymentReferenceTest(AccountTestInvoicingCommon):
|
||||
"""
|
||||
All references validated with the reference calculator by Nordea Bank
|
||||
http://www.nordea.fi/en/corporate-customers/payments/invoicing-and-payments/reference-number-calculator.html
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref='l10n_fi.fi_chart_template'):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
|
||||
cls.invoice = cls.init_invoice('out_invoice', products=cls.product_a+cls.product_b)
|
||||
|
||||
def test_payment_reference_fi(self):
|
||||
|
||||
compute = self.invoice.compute_payment_reference_finnish
|
||||
|
||||
# Common
|
||||
self.assertEqual('1232', compute('INV123'))
|
||||
self.assertEqual('1326', compute('132'))
|
||||
self.assertEqual('1290', compute('ABC1B2B9C'))
|
||||
|
||||
# Insufficient
|
||||
self.assertEqual('1119', compute('-1'))
|
||||
self.assertEqual('1106', compute('0'))
|
||||
self.assertEqual('1261', compute('26'))
|
||||
|
||||
# Excess length
|
||||
self.assertEqual('12345678901234567894', compute('123456789012345678901234567890'))
|
||||
|
||||
# Invalid
|
||||
with self.assertRaises(UserError):
|
||||
compute('QWERTY')
|
||||
|
||||
def test_payment_reference_rf(self):
|
||||
|
||||
compute = self.invoice.compute_payment_reference_finnish_rf
|
||||
|
||||
# Common
|
||||
self.assertEqual('RF111232', compute('INV123'))
|
||||
self.assertEqual('RF921326', compute('132'))
|
||||
self.assertEqual('RF941290', compute('ABC1B2B9C'))
|
||||
|
||||
# Insufficient
|
||||
self.assertEqual('RF551119', compute('-1'))
|
||||
self.assertEqual('RF181106', compute('0'))
|
||||
self.assertEqual('RF041261', compute('26'))
|
||||
|
||||
# Excess length
|
||||
self.assertEqual('RF0912345678901234567894', compute('123456789012345678901234567890'))
|
||||
|
||||
# Invalid
|
||||
with self.assertRaises(UserError):
|
||||
compute('QWERTY')
|
||||
Loading…
Add table
Add a link
Reference in a new issue