Skip to content

Commit 9847f16

Browse files
committed
[IMP] l10n_id: show DPP value
Due to government regulations, tax base amount is multiplied by factor of 11/12 and tax value of 12% resulting to essentially 11% of tax. We need to display this DPP value both on invoice form view and reports 4485693 closes odoo#214289 X-original-commit: 4e57e7d Signed-off-by: Habib Ayob (ayh) <[email protected]> Signed-off-by: Nigel Nicholas (nni) <[email protected]>
1 parent 158a4b1 commit 9847f16

File tree

8 files changed

+86
-13
lines changed

8 files changed

+86
-13
lines changed

addons/l10n_id/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name': 'Indonesian - Accounting',
44
'icon': '/account/static/description/l10n.png',
55
'countries': ['id'],
6-
'version': '1.1',
6+
'version': '1.2',
77
'category': 'Accounting/Localizations/Account Charts',
88
'description': """
99
This is the latest Indonesian Odoo localisation necessary to run Odoo accounting for SMEs with:

addons/l10n_id/data/account_tax_template_data.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<odoo>
2+
<odoo noupdate="1">
33
<record id="ppn_tag" model="account.account.tag">
44
<field name="name">PPN - 08</field>
55
<field name="applicability">taxes</field>

addons/l10n_id/data/template/account.tax-id.csv

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
"id","description","invoice_label","type_tax_use","tax_group_id","name","amount_type","amount","repartition_line_ids/repartition_type","repartition_line_ids/tag_ids","repartition_line_ids/document_type","repartition_line_ids/account_id"
2-
"tax_ST1","ST1","11%","sale","default_tax_group","11%","percent","11.0","base","l10n_id.ppn_tag","invoice",""
2+
"tax_ST1","ST1","12%","sale","l10n_id_tax_group_non_luxury_goods","11%","percent","11.0","base","l10n_id.ppn_tag","invoice",""
33
"","","","","","","","","tax","","invoice","l10n_id_21221020"
44
"","","","","","","","","base","l10n_id.ppn_tag","refund",""
55
"","","","","","","","","tax","","refund","l10n_id_21221020"
6-
"tax_PT1","PT1","11%","purchase","default_tax_group","11%","percent","11.0","base","l10n_id.ppn_tag","invoice",""
6+
"tax_PT1","PT1","12%","purchase","l10n_id_tax_group_non_luxury_goods","11%","percent","11.0","base","l10n_id.ppn_tag","invoice",""
77
"","","","","","","","","tax","","invoice","l10n_id_21221010"
88
"","","","","","","","","base","l10n_id.ppn_tag","refund",""
99
"","","","","","","","","tax","","refund","l10n_id_21221010"
10-
"tax_ST0","ST0","0%","sale","default_tax_group","0%","percent","0.0","base","","invoice",""
10+
"tax_ST0","ST0","0%","sale","l10n_id_tax_group_0","0%","percent","0.0","base","","invoice",""
1111
"","","","","","","","","tax","","invoice","l10n_id_21221020"
1212
"","","","","","","","","base","","refund",""
1313
"","","","","","","","","tax","","refund","l10n_id_21221020"
14-
"tax_ST2","ST2","0%","sale","default_tax_group","0% EXEMPT","percent","0.0","base","","invoice",""
14+
"tax_ST2","ST2","0%","sale","l10n_id_tax_group_exempt","0% EXEMPT","percent","0.0","base","","invoice",""
1515
"","","","","","","","","tax","","invoice","l10n_id_21221020"
1616
"","","","","","","","","base","","refund",""
1717
"","","","","","","","","tax","","refund","l10n_id_21221020"
18-
"tax_PT2","PT2","0%","purchase","default_tax_group","0% EXEMPT","percent","0.0","base","","invoice",""
18+
"tax_PT2","PT2","0%","purchase","l10n_id_tax_group_exempt","0% EXEMPT","percent","0.0","base","","invoice",""
1919
"","","","","","","","","tax","","invoice","l10n_id_21221010"
2020
"","","","","","","","","base","","refund",""
2121
"","","","","","","","","tax","","refund","l10n_id_21221010"
22-
"tax_PT0","PT0","0%","purchase","default_tax_group","0%","percent","0.0","base","","invoice",""
22+
"tax_PT0","PT0","0%","purchase","l10n_id_tax_group_0","0%","percent","0.0","base","","invoice",""
2323
"","","","","","","","","tax","","invoice","l10n_id_21221010"
2424
"","","","","","","","","base","","refund",""
2525
"","","","","","","","","tax","","refund","l10n_id_21221010"
26-
"tax_ST3","ST3","12%","sale","default_tax_group","12%","percent","12.0","base","l10n_id.ppn_tag","invoice",""
26+
"tax_ST3","ST3","12%","sale","l10n_id_tax_group_luxury_goods","12%","percent","12.0","base","l10n_id.ppn_tag","invoice",""
2727
"","","","","","","","","tax","","invoice","l10n_id_21221020"
2828
"","","","","","","","","base","l10n_id.ppn_tag","refund",""
2929
"","","","","","","","","tax","","refund","l10n_id_21221020"
30-
"tax_PT3","PT3","12%","purchase","default_tax_group","12%","percent","12.0","base","l10n_id.ppn_tag","invoice",""
30+
"tax_PT3","PT3","12%","purchase","l10n_id_tax_group_luxury_goods","12%","percent","12.0","base","l10n_id.ppn_tag","invoice",""
3131
"","","","","","","","","tax","","invoice","l10n_id_21221010"
3232
"","","","","","","","","base","l10n_id.ppn_tag","refund",""
3333
"","","","","","","","","tax","","refund","l10n_id_21221010"
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
"id","country_id","name","name@id"
22
"default_tax_group","base.id","Taxes","Pajak"
3-
"l10n_id_tax_group_luxury_goods","base.id","Luxury Good Taxes (ID)","Pajak Barang Mewah (ID)"
3+
"l10n_id_tax_group_luxury_goods","base.id","Luxury Good Taxes","Pajak Barang Mewah"
4+
"l10n_id_tax_group_non_luxury_goods","base.id","Non-luxury Good Taxes","Pajak Barang"
5+
"l10n_id_tax_group_0","base.id","Zero-rated Taxes","Pajak Nol"
6+
"l10n_id_tax_group_exempt","base.id","Tax Exempted","Bebas Pajak"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
from odoo import api, SUPERUSER_ID
3+
4+
5+
def migrate(cr, version):
6+
env = api.Environment(cr, SUPERUSER_ID, {})
7+
8+
# Load the new tax groups if it doesn't exist yet
9+
ChartTemplate = env["account.chart.template"]
10+
companies = env['res.company'].search([('chart_template', '=', 'id')], order="parent_path")
11+
12+
new_tax_groups = ["l10n_id_tax_group_non_luxury_goods", "l10n_id_tax_group_0", "l10n_id_tax_group_exempt"]
13+
14+
tax_group_data = {
15+
xmlid: data
16+
for xmlid, data in ChartTemplate._get_account_tax_group('id').items()
17+
if xmlid in new_tax_groups
18+
}
19+
20+
# For taxes: tax_ST1 and tax_PT1 which are non-luxury tax, if the amount and tax group
21+
# has not been changed yet by user, we update the tax group and description
22+
for company in companies:
23+
ChartTemplate.with_company(company)._load_data({
24+
"account.tax.group": tax_group_data,
25+
})
26+
tax_ST1 = ChartTemplate.with_company(company).ref("tax_ST1", raise_if_not_found=False)
27+
tax_PT1 = ChartTemplate.with_company(company).ref("tax_PT1", raise_if_not_found=False)
28+
29+
old_group = ChartTemplate.with_company(company).ref("default_tax_group", raise_if_not_found=False)
30+
new_group = ChartTemplate.with_company(company).ref("l10n_id_tax_group_non_luxury_goods")
31+
32+
if not old_group:
33+
continue
34+
35+
for tax in [tax_ST1, tax_PT1]:
36+
if tax and tax.amount == 11.0 and tax.tax_group_id == old_group:
37+
tax.write({
38+
"tax_group_id": new_group.id,
39+
"description": "12%",
40+
})

addons/l10n_id/models/account_move.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,35 @@ def _l10n_id_process_invoices(self, invoices_statuses):
103103
return self.env['account.payment.register'].with_context(
104104
active_model='account.move', active_ids=paid_invoices.ids
105105
).create({'group_payment': False}).action_create_payments()
106+
107+
def _compute_tax_totals(self):
108+
""" OVERRIDE
109+
110+
For invoices based on ID company as of January 2025, there is a separate tax base computation for non-luxury goods.
111+
Tax base is supposed to be 11/12 of original while tax amount is increased from 11% to 12% hence effectively
112+
maintaining 11% tax amount.
113+
114+
We change tax totals section to display adjusted base amount on invoice PDF for special non-luxury goods tax group.
115+
"""
116+
super()._compute_tax_totals()
117+
for move in self.filtered(lambda m: m.is_sale_document()):
118+
# invoice might be coming from different companies, each tax group with unique XML ID
119+
non_luxury_tax_group = self.env['account.chart.template'].with_company(move.company_id.id).ref("l10n_id_tax_group_non_luxury_goods", raise_if_not_found=False)
120+
121+
if not non_luxury_tax_group or move.invoice_date and move.invoice_date < fields.Date.to_date('2025-01-01'):
122+
continue
123+
124+
# for every tax group component with non-luxury tax group, we adjust the base amount and adjust the display to
125+
# show base amount
126+
change_tax_base = False
127+
for subtotal in move.tax_totals["subtotals"]:
128+
for tax_group in subtotal["tax_groups"]:
129+
if tax_group["id"] == non_luxury_tax_group.id:
130+
tax_group.update({
131+
"display_base_amount": tax_group["display_base_amount"] * (11 / 12),
132+
"display_base_amount_currency": tax_group["display_base_amount_currency"] * (11 / 12),
133+
"group_name": tax_group["group_name"] + " (on DPP)",
134+
})
135+
change_tax_base = True
136+
if change_tax_base:
137+
move.tax_totals["same_tax_base"] = False

addons/l10n_id_efaktur_coretax/models/account_move.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from odoo import _, api, fields, models
44
from odoo.exceptions import UserError, ValidationError, RedirectWarning
5-
from odoo.tools import cleanup_xml_node
65

76
COUNTRY_CODE_MAP = {
87
"BD": "BGD", "BE": "BEL", "BF": "BFA", "BG": "BGR", "BA": "BIH", "BB": "BRB", "WF": "WLF", "BL": "BLM", "BM": "BMU",

addons/l10n_id_efaktur_coretax/tests/test_l10n_id_efaktur_coretax.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ def test_efaktur_xml_luxury_goods(self):
540540
</xpath>
541541
'''
542542
)
543-
544543
self.assertXmlTreeEqual(result_tree, expected_tree)
545544

546545
def test_invoice_user_main_contact(self):

0 commit comments

Comments
 (0)