summaryrefslogtreecommitdiff
path: root/addons/l10n_fi/tests/test_get_reference.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/l10n_fi/tests/test_get_reference.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/l10n_fi/tests/test_get_reference.py')
-rw-r--r--addons/l10n_fi/tests/test_get_reference.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/addons/l10n_fi/tests/test_get_reference.py b/addons/l10n_fi/tests/test_get_reference.py
new file mode 100644
index 00000000..ea41528a
--- /dev/null
+++ b/addons/l10n_fi/tests/test_get_reference.py
@@ -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', '-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)