Debian Codegraph @

addons/l10n_in_pos/tests/test_gstr_section.py

raw
1 from odoo.addons.l10n_in_pos.tests.common import TestInPosBase
2 from odoo.tests import tagged
3 from datetime import date
4
5 TEST_DATE = date(2023, 5, 20)
6
7
8 @tagged('post_install_l10n', 'post_install', '-at_install')
9 class TestPOSGstrSection(TestInPosBase):
10
11 def test_b2cs_gstr_section_with_pos_order(self):
12 with self.with_pos_session() as session:
13 self._create_order({
14 'pos_order_lines_ui_args': [
15 (self.product_a, 2.0), # 2 units of product A
16 (self.product_b, 2.0), # 2 units of product B
17 ],
18 'payments': [(self.bank_pm1, 630.0)],
19 })
20 session.action_pos_session_closing_control()
21 pos_entry_lines = session.move_id.line_ids
22 for line in pos_entry_lines.filtered(lambda l: l.display_type in ('product, tax')):
23 self.assertEqual(line.l10n_in_gstr_section, 'sale_b2cs')
24
25 def test_nil_rated_gstr_section_with_pos_order(self):
26 with self.with_pos_session() as session:
27 self._create_order({
28 'pos_order_lines_ui_args': [
29 (self.product_c, 3.0), # 3 units of product C
30 ],
31 'payments': [(self.bank_pm1, 900.0)],
32 'customer': self.partner_a,
33 })
34 session.action_pos_session_closing_control()
35 pos_entry_lines = session.move_id.line_ids
36 for line in pos_entry_lines.filtered(lambda l: l.display_type in ('product, tax')):
37 self.assertEqual(line.l10n_in_gstr_section, 'sale_nil_rated')