Add an easy way to not post the entries in the future when calling post() on it, but rather set it to be auto-posted at accounting date. This is useful when we are creating a lot of entries in batch and some might be in the future, some in the past, and we don't want to separate that in two batch every time. (asset, accrual, transfer,... )
40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
# 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')
|
|
|
|
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)
|