Skip to content

Commit 0beb72a

Browse files
nesma-nehagawa-odoo
authored andcommitted
[IMP] l10n_sa: overhaul accounting
We have made significant improvements to the accounting module in this PR. The key changes include: 1. **Chart of Accounts Update**: Revised the account types for better accuracy and compliance with the latest standards. 2. **Tax Reports Enhancement**: Overhauled the VAT Return and Withholding Report. These reports are now more readable and utilize a custom engine, moving away from the outdated single-column format. 3. **Withholding Tax Setup**: Corrected and completed the withholding tax setup to support both Gross Withholding Tax (using Cash Basis) and Deducted Withholding Tax (leveraging the new `l10n_account_withholding` with a new module auto-installed). 4. **Reverse Charge Taxes**: Fixed the setup for Reverse Charge Taxes to align with the correct accounting practices. 5. **Tax Format Update**: Updated the tax format to adhere to the latest conventions, ensuring consistency and clarity. These changes aim to modernize the module, improve accuracy, and enhance the usability of the accounting and tax reporting features. closes odoo#218469 Task-id: 4745275 Related: odoo/enterprise#90006 Signed-off-by: Wala Gauthier (gawa) <[email protected]>
1 parent 079fc98 commit 0beb72a

File tree

15 files changed

+958
-748
lines changed

15 files changed

+958
-748
lines changed

addons/l10n_sa/__manifest__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
'name': 'Saudi Arabia - Accounting',
44
'icon': '/account/static/description/l10n.png',
55
'countries': ['sa'],
6-
'version': '2.0',
7-
'author': 'Odoo S.A., DVIT.ME (http://www.dvit.me)',
6+
'version': '2.1',
7+
'author': 'Odoo S.A.',
88
'category': 'Accounting/Localizations/Account Charts',
99
'website': 'https://www.odoo.com/documentation/latest/applications/finance/fiscal_localizations/saudi_arabia.html',
1010
'description': """
@@ -16,8 +16,8 @@
1616
1717
- Chart of Accounts
1818
- Taxes
19-
- Vat Filling Report
20-
- Withholding Tax Report
19+
- VAT Return
20+
- Withholding Return
2121
- Fiscal Positions
2222
""",
2323
'depends': [
@@ -29,6 +29,7 @@
2929
'data': [
3030
'data/account_data.xml',
3131
'data/account_tax_report_data.xml',
32+
'data/account_tax_report_withholding_data.xml',
3233
'data/report_paperformat_data.xml',
3334
'views/account_move_views.xml',
3435
'views/report_invoice.xml',

addons/l10n_sa/data/account_tax_report_data.xml

Lines changed: 201 additions & 576 deletions
Large diffs are not rendered by default.

addons/l10n_sa/data/account_tax_report_withholding_data.xml

Lines changed: 455 additions & 0 deletions
Large diffs are not rendered by default.

addons/l10n_sa/data/template/account.account-sa.csv

Lines changed: 46 additions & 41 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
"id","name","auto_apply","sequence","country_id","country_group_id"
2-
"l10n_sa_account_fiscal_position_ksa","KSA","1","16","base.sa",""
3-
"l10n_sa_account_fiscal_position_gcc","GCC","1","26","","base.gulf_cooperation_council"
4-
"l10n_sa_account_fiscal_position_non_gcc","Non-GCC","","36","",""
2+
"l10n_sa_account_fiscal_position_ksa","Saudi Arabia","1","16","base.sa",""
3+
"l10n_sa_account_fiscal_position_gcc","Non-Saudi Arabia","1","26","",""

addons/l10n_sa/data/template/account.tax-sa.csv

Lines changed: 127 additions & 117 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
"id","name","country_id","tax_receivable_account_id","tax_payable_account_id"
2-
"sa_tax_group_taxes_15","VAT Taxes","base.sa","sa_account_100103","sa_account_202003"
3-
"sa_tax_group_taxes_other","Other Taxes","base.sa","sa_account_100103","sa_account_202003"
4-
"sa_tax_group_taxes_withholding","Withholding Tax","base.sa","sa_account_100103","sa_account_202003"
1+
"id","name","country_id","tax_receivable_account_id","tax_payable_account_id","name@ar"
2+
"sa_tax_group_taxes_vat","VAT Total Amount","base.sa","sa_account_100103","sa_account_202003",""
3+
"sa_tax_group_taxes_withholding_5","Withholding 5%","base.sa","sa_account_100103","sa_account_202003",""
4+
"sa_tax_group_taxes_withholding_15","Withholding 15%","base.sa","sa_account_100103","sa_account_202003",""
5+
"sa_tax_group_taxes_withholding_20","Withholding 20%","base.sa","sa_account_100103","sa_account_202003",""
6+
"sa_tax_group_taxes_import_15","Import VAT 15%","base.sa","sa_account_100103","sa_account_202003",""

addons/l10n_sa/i18n_extra/ar.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ msgstr "إظهار سبب توطين السعودية"
306306

307307
#. module: l10n_sa
308308
#: model:account.report.line,name:l10n_sa.tax_report_line_net_vat_due
309-
msgid "Net VAT Due"
309+
msgid "Net VAT Due (or claim)"
310310
msgstr "صافي الضريبة المستحق"
311311

312312
#. module: l10n_sa

addons/l10n_sa/i18n_extra/l10n_sa.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ msgstr ""
309309

310310
#. module: l10n_sa
311311
#: model:account.report.line,name:l10n_sa.tax_report_line_net_vat_due
312-
msgid "Net VAT Due"
312+
msgid "Net VAT Due (or claim)"
313313
msgstr ""
314314

315315
#. module: l10n_sa
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from odoo import SUPERUSER_ID, api
2+
3+
4+
def migrate(cr, version):
5+
""" Remove the tags on these taxes to avoid having clearly misconfigured ones """
6+
tax_xmlid_regex = "_sa_(?:local_sales_tax_0|export_sales_tax_0|exempt_sales_tax_0|purchases_tax_0|exempt_purchases_tax|rcp_tax_15)$"
7+
cr.execute(
8+
"""
9+
WITH tags_to_delete AS (
10+
SELECT tag_rel.*
11+
FROM account_account_tag_account_tax_repartition_line_rel AS tag_rel
12+
JOIN account_tax_repartition_line AS rep_line
13+
ON rep_line.id = tag_rel.account_tax_repartition_line_id
14+
JOIN account_tax AS tax
15+
ON tax.id = rep_line.tax_id
16+
JOIN ir_model_data AS imd_taxes
17+
ON imd_taxes.res_id = tax.id
18+
AND imd_taxes.model = 'account.tax'
19+
AND imd_taxes.module = 'account'
20+
JOIN res_company company
21+
ON company.chart_template = 'sa'
22+
WHERE rep_line.repartition_type = 'tax'
23+
AND imd_taxes.name ~ ('^' || company.id || %s)
24+
)
25+
DELETE
26+
FROM account_account_tag_account_tax_repartition_line_rel AS tag_rel
27+
USING tags_to_delete t
28+
WHERE tag_rel.account_tax_repartition_line_id = t.account_tax_repartition_line_id
29+
AND tag_rel.account_account_tag_id = t.account_account_tag_id;
30+
""",
31+
[tax_xmlid_regex],
32+
)
33+
34+
env = api.Environment(cr, SUPERUSER_ID, {})
35+
for company in env["res.company"].search([("chart_template", "=", "sa")], order="parent_path"):
36+
env["account.chart.template"].try_loading("sa", company)

0 commit comments

Comments
 (0)