Debian Codegraph @

addons/l10n_sa_edi_pos/tests/test_sa_edi_pos.py

raw symbols SCIP
1 from unittest.mock import patch
2
3 from odoo.tests import tagged
4
5 from odoo.addons.account.tests.common import AccountTestInvoicingCommon
6 from odoo.addons.l10n_sa_edi.tests.common import AccountEdiTestCommon
7 from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon
8 from odoo.addons.point_of_sale.tests.test_generic_localization import (
9 TestGenericLocalization,
10 )
11
12
13 @tagged('post_install', '-at_install', 'post_install_l10n')
14 class TestGenericSAEdi(TestGenericLocalization):
15 @classmethod
16 @AccountEdiTestCommon.setup_edi_format('l10n_sa_edi.edi_sa_zatca')
17 @AccountTestInvoicingCommon.setup_country('sa')
18 def setUpClass(cls):
19 super().setUpClass()
20 cls.main_pos_config.journal_id._l10n_sa_load_edi_demo_data()
21 cls.company.write({
22 'name': 'Generic SA EDI',
23 'email': '[email protected]',
24 'phone': '+966 51 234 5678',
25 'street2': 'Testomania',
26 'vat': '311111111111113',
27 'state_id': cls.env['res.country.state'].create({
28 'name': 'Riyadh',
29 'code': 'RYA',
30 'country_id': cls.company.country_id.id
31 }),
32 'street': 'Al Amir Mohammed Bin Abdul Aziz Street',
33 'city': 'المدينة المنورة',
34 'zip': '42317',
35 'l10n_sa_edi_building_number': '1234',
36 })
37
38
39 @tagged('post_install_l10n', 'post_install', '-at_install')
40 class TestUi(TestPointOfSaleHttpCommon):
41
42 @classmethod
43 @AccountEdiTestCommon.setup_country('sa')
44 def setUpClass(cls):
45 super().setUpClass()
46
47 @patch('odoo.addons.l10n_sa_edi.models.account_journal.AccountJournal._l10n_sa_ready_to_submit_einvoices',
48 new=lambda self: True)
49 def test_ZATCA_invoice_not_mandatory_if_settlement(self):
50 """
51 Tests that the invoice is not mandatory in POS payment for ZATCA if it's a settlement.
52 """
53 self.test_partner = self.env["res.partner"].create({"name": "AAA Partner"})
54 self.start_tour(
55 "/pos/ui?config_id=%d" % self.main_pos_config.id,
56 'ZATCA_invoice_not_mandatory_if_settlement',
57 login="pos_admin",
58 )
59
60 @patch('odoo.addons.l10n_sa_edi.models.account_journal.AccountJournal._l10n_sa_ready_to_submit_einvoices',
61 new=lambda self: True)
62 def test_ZATCA_invoice_mandatory_if_not_settlement(self):
63 """
64 Tests that the invoice is mandatory in POS payment for ZATCA.
65 Also is by default checked.
66 """
67 self.test_partner = self.env["res.partner"].create({"name": "AAA Partner"})
68 self.start_tour(
69 "/pos/ui?config_id=%d" % self.main_pos_config.id,
70 'ZATCA_invoice_mandatory_if_not_settlement',
71 login="pos_admin",
72 )