Debian Codegraph @

addons/l10n_hu_edi/tests/test_credit_debit_notes.py

raw
1 from odoo.tests.common import tagged
2 from odoo.addons.l10n_hu_edi.tests.common import L10nHuEdiTestCommon
3 from freezegun import freeze_time
4
5
6 @tagged('post_install_l10n', '-at_install', 'post_install')
7 class TestL10nHuEdiCreditDebitNotes(L10nHuEdiTestCommon):
8 """Tests for Credit and Debit Notes in the Hungarian EDI localization."""
9
10 @classmethod
11 def setUpClass(cls):
12 super().setUpClass()
13
14 @freeze_time('2025-01-01')
15 def test_credit_note_preserves_delivery_date(self):
16 """Ensure that the credit note inherits the delivery date from the original invoice."""
17 invoice = self.create_invoice_simple()
18 invoice.action_post()
19
20 credit_note = self.create_reversal(invoice)
21 self.assertEqual(
22 invoice.delivery_date,
23 credit_note.delivery_date,
24 "Credit note should inherit the delivery date from the original invoice."
25 )
26
27 @freeze_time('2025-01-01')
28 def test_debit_note_preserves_delivery_date(self):
29 """Ensure that the debit note inherits the delivery date from the original invoice."""
30 invoice = self.create_invoice_simple()
31 invoice.action_post()
32
33 wizard = self.env['account.debit.note'].with_context(
34 active_ids=invoice.ids,
35 active_model='account.move'
36 ).create({'reason': 'Test debit note'})
37 wizard.create_debit()
38
39 debit_note = invoice.debit_note_ids
40 self.assertEqual(
41 invoice.delivery_date,
42 debit_note.delivery_date,
43 "Debit note should inherit the delivery date from the original invoice."
44 )