shutro-erp 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +17 -10
  2. package/dist/account_portal/.kosh/bindings.d.ts +22 -0
  3. package/dist/account_portal/.kosh/bindings.js +15 -0
  4. package/dist/account_portal/.kosh/schema.d.ts +1350 -0
  5. package/dist/account_portal/index.d.ts +3 -0
  6. package/dist/account_portal/index.js +73 -0
  7. package/dist/account_portal/module.d.ts +5983 -0
  8. package/dist/account_portal/module.js +18 -0
  9. package/dist/accounting/.kosh/bindings.js +1 -1
  10. package/dist/accounting/.kosh/schema.d.ts +142 -9
  11. package/dist/accounting/chart.d.ts +40 -8
  12. package/dist/accounting/chart.js +124 -30
  13. package/dist/accounting/closing.d.ts +6 -1
  14. package/dist/accounting/closing.js +5 -1
  15. package/dist/accounting/demo.js +6 -5
  16. package/dist/accounting/index.d.ts +3 -3
  17. package/dist/accounting/index.js +200 -23
  18. package/dist/accounting/module.d.ts +3326 -1086
  19. package/dist/accounting/module.js +408 -66
  20. package/dist/accounting/payments.d.ts +25 -0
  21. package/dist/accounting/payments.js +96 -4
  22. package/dist/accounting/web/RegisterPayment.d.ts +3 -2
  23. package/dist/accounting/web/RegisterPayment.js +39 -6
  24. package/dist/accounting/web/SettingsPage.js +5 -1
  25. package/dist/accounting/web/messages.js +10 -0
  26. package/dist/cli/init.js +172 -48
  27. package/dist/cli/launch.d.ts +16 -0
  28. package/dist/cli/launch.js +138 -0
  29. package/dist/cli/prompt.d.ts +35 -0
  30. package/dist/cli/prompt.js +46 -0
  31. package/dist/cli/templates.d.ts +11 -3
  32. package/dist/cli/templates.js +32 -7
  33. package/dist/cli/tui.d.ts +7 -0
  34. package/dist/cli/tui.js +254 -0
  35. package/dist/cli/ui.d.ts +25 -5
  36. package/dist/cli/ui.js +49 -9
  37. package/dist/contacts/.kosh/bindings.js +1 -1
  38. package/dist/contacts/.kosh/schema.d.ts +3 -1
  39. package/dist/contacts/index.js +24 -1
  40. package/dist/contacts/module.d.ts +42 -0
  41. package/dist/contacts/module.js +3 -1
  42. package/dist/import/convert.d.ts +55 -0
  43. package/dist/import/convert.js +224 -0
  44. package/dist/import/csv.d.ts +28 -0
  45. package/dist/import/csv.js +115 -0
  46. package/dist/import/index.d.ts +33 -0
  47. package/dist/import/index.js +60 -0
  48. package/dist/import/mapping.d.ts +15 -0
  49. package/dist/import/mapping.js +33 -0
  50. package/dist/import/match.d.ts +24 -0
  51. package/dist/import/match.js +60 -0
  52. package/dist/import/models.d.ts +2 -0
  53. package/dist/import/models.js +102 -0
  54. package/dist/import/routes.d.ts +13 -0
  55. package/dist/import/routes.js +392 -0
  56. package/dist/import/run.d.ts +131 -0
  57. package/dist/import/run.js +568 -0
  58. package/dist/import/service.d.ts +153 -0
  59. package/dist/import/service.js +367 -0
  60. package/dist/import/web/ImportButton.d.ts +7 -0
  61. package/dist/import/web/ImportButton.js +31 -0
  62. package/dist/import/web/ImportWizard.d.ts +75 -0
  63. package/dist/import/web/ImportWizard.js +217 -0
  64. package/dist/import/web/index.d.ts +13 -0
  65. package/dist/import/web/index.js +18 -0
  66. package/dist/import/web/messages.d.ts +2 -0
  67. package/dist/import/web/messages.js +139 -0
  68. package/dist/import/worker.d.ts +3 -0
  69. package/dist/import/worker.js +52 -0
  70. package/dist/import/xlsx.d.ts +20 -0
  71. package/dist/import/xlsx.js +192 -0
  72. package/dist/l10n_bd/.kosh/bindings.d.ts +22 -0
  73. package/dist/l10n_bd/.kosh/bindings.js +15 -0
  74. package/dist/l10n_bd/.kosh/schema.d.ts +1281 -0
  75. package/dist/l10n_bd/documents.d.ts +8 -0
  76. package/dist/l10n_bd/documents.js +183 -0
  77. package/dist/l10n_bd/index.d.ts +8 -0
  78. package/dist/l10n_bd/index.js +156 -0
  79. package/dist/l10n_bd/module.d.ts +5705 -0
  80. package/dist/l10n_bd/module.js +163 -0
  81. package/dist/l10n_bd/mushak.d.ts +67 -0
  82. package/dist/l10n_bd/mushak.js +139 -0
  83. package/dist/l10n_bd/routes.d.ts +3 -0
  84. package/dist/l10n_bd/routes.js +205 -0
  85. package/dist/l10n_bd/web/MushakPage.d.ts +7 -0
  86. package/dist/l10n_bd/web/MushakPage.js +53 -0
  87. package/dist/l10n_bd/web/index.d.ts +13 -0
  88. package/dist/l10n_bd/web/index.js +18 -0
  89. package/dist/l10n_bd/web/messages.d.ts +2 -0
  90. package/dist/l10n_bd/web/messages.js +101 -0
  91. package/dist/l10n_in/.kosh/bindings.d.ts +22 -0
  92. package/dist/l10n_in/.kosh/bindings.js +15 -0
  93. package/dist/l10n_in/.kosh/schema.d.ts +1343 -0
  94. package/dist/l10n_in/documents.d.ts +8 -0
  95. package/dist/l10n_in/documents.js +114 -0
  96. package/dist/l10n_in/einvoice.d.ts +253 -0
  97. package/dist/l10n_in/einvoice.js +485 -0
  98. package/dist/l10n_in/gstr.d.ts +109 -0
  99. package/dist/l10n_in/gstr.js +430 -0
  100. package/dist/l10n_in/index.d.ts +20 -0
  101. package/dist/l10n_in/index.js +232 -0
  102. package/dist/l10n_in/module.d.ts +7823 -0
  103. package/dist/l10n_in/module.js +427 -0
  104. package/dist/l10n_in/routes-einvoice.d.ts +15 -0
  105. package/dist/l10n_in/routes-einvoice.js +124 -0
  106. package/dist/l10n_in/routes.d.ts +17 -0
  107. package/dist/l10n_in/routes.js +282 -0
  108. package/dist/l10n_in/web/EInvoicePanel.d.ts +8 -0
  109. package/dist/l10n_in/web/EInvoicePanel.js +63 -0
  110. package/dist/l10n_in/web/GstPage.d.ts +7 -0
  111. package/dist/l10n_in/web/GstPage.js +57 -0
  112. package/dist/l10n_in/web/GstSettings.d.ts +10 -0
  113. package/dist/l10n_in/web/GstSettings.js +36 -0
  114. package/dist/l10n_in/web/index.d.ts +15 -0
  115. package/dist/l10n_in/web/index.js +22 -0
  116. package/dist/l10n_in/web/messages.d.ts +2 -0
  117. package/dist/l10n_in/web/messages.js +166 -0
  118. package/dist/modules-sdk/demo.d.ts +2 -0
  119. package/dist/modules-sdk/demo.js +7 -3
  120. package/dist/modules-sdk/index.d.ts +2 -2
  121. package/dist/modules-sdk/index.js +1 -1
  122. package/dist/modules-sdk/manifest.d.ts +132 -0
  123. package/dist/modules-sdk/manifest.js +22 -0
  124. package/dist/notify/inbox.js +21 -0
  125. package/dist/notify/messages.js +4 -0
  126. package/dist/notify/models.d.ts +1 -1
  127. package/dist/notify/models.js +2 -0
  128. package/dist/notify/web/messages.js +4 -0
  129. package/dist/portal/.kosh/bindings.d.ts +22 -0
  130. package/dist/portal/.kosh/bindings.js +15 -0
  131. package/dist/portal/.kosh/schema.d.ts +346 -0
  132. package/dist/portal/announce.d.ts +16 -0
  133. package/dist/portal/announce.js +117 -0
  134. package/dist/portal/documents.d.ts +17 -0
  135. package/dist/portal/documents.js +61 -0
  136. package/dist/portal/index.d.ts +20 -0
  137. package/dist/portal/index.js +65 -0
  138. package/dist/portal/module.d.ts +1405 -0
  139. package/dist/portal/module.js +84 -0
  140. package/dist/portal/routes-documents.d.ts +2 -0
  141. package/dist/portal/routes-documents.js +391 -0
  142. package/dist/portal/routes.d.ts +13 -0
  143. package/dist/portal/routes.js +313 -0
  144. package/dist/portal/rules.d.ts +11 -0
  145. package/dist/portal/rules.js +25 -0
  146. package/dist/portal/web/PortalAccess.d.ts +8 -0
  147. package/dist/portal/web/PortalAccess.js +66 -0
  148. package/dist/portal/web/index.d.ts +12 -0
  149. package/dist/portal/web/index.js +17 -0
  150. package/dist/portal/web/messages.d.ts +2 -0
  151. package/dist/portal/web/messages.js +33 -0
  152. package/dist/product/.kosh/bindings.js +1 -1
  153. package/dist/product/.kosh/schema.d.ts +12 -3
  154. package/dist/product/demo.js +6 -5
  155. package/dist/product/index.d.ts +1 -0
  156. package/dist/product/index.js +17 -4
  157. package/dist/product/module.d.ts +346 -14
  158. package/dist/product/module.js +48 -18
  159. package/dist/product/taxes.d.ts +59 -0
  160. package/dist/product/taxes.js +61 -0
  161. package/dist/project/.kosh/bindings.js +1 -1
  162. package/dist/project/.kosh/schema.d.ts +3 -1
  163. package/dist/project/module.d.ts +20 -0
  164. package/dist/project_portal/.kosh/bindings.d.ts +22 -0
  165. package/dist/project_portal/.kosh/bindings.js +15 -0
  166. package/dist/project_portal/.kosh/schema.d.ts +671 -0
  167. package/dist/project_portal/index.d.ts +9 -0
  168. package/dist/project_portal/index.js +42 -0
  169. package/dist/project_portal/module.d.ts +2142 -0
  170. package/dist/project_portal/module.js +22 -0
  171. package/dist/purchase/.kosh/bindings.js +1 -1
  172. package/dist/purchase/.kosh/schema.d.ts +15 -4
  173. package/dist/purchase/demo.js +3 -3
  174. package/dist/purchase/index.js +1 -1
  175. package/dist/purchase/module.d.ts +232 -8
  176. package/dist/purchase/module.js +51 -9
  177. package/dist/purchase_account/.kosh/bindings.js +1 -1
  178. package/dist/purchase_account/.kosh/schema.d.ts +144 -10
  179. package/dist/purchase_account/module.d.ts +2008 -641
  180. package/dist/purchase_account/module.js +2 -2
  181. package/dist/purchase_portal/.kosh/bindings.d.ts +22 -0
  182. package/dist/purchase_portal/.kosh/bindings.js +15 -0
  183. package/dist/purchase_portal/.kosh/schema.d.ts +822 -0
  184. package/dist/purchase_portal/index.d.ts +9 -0
  185. package/dist/purchase_portal/index.js +53 -0
  186. package/dist/purchase_portal/module.d.ts +2758 -0
  187. package/dist/purchase_portal/module.js +18 -0
  188. package/dist/reporting/documents.js +20 -3
  189. package/dist/reporting/index.d.ts +1 -0
  190. package/dist/reporting/index.js +1 -0
  191. package/dist/reporting/routes-documents.js +9 -2
  192. package/dist/reporting/words.d.ts +11 -0
  193. package/dist/reporting/words.js +229 -0
  194. package/dist/sale_account/.kosh/bindings.js +1 -1
  195. package/dist/sale_account/.kosh/schema.d.ts +144 -10
  196. package/dist/sale_account/module.d.ts +2008 -641
  197. package/dist/sale_account/module.js +3 -3
  198. package/dist/sale_portal/.kosh/bindings.d.ts +22 -0
  199. package/dist/sale_portal/.kosh/bindings.js +15 -0
  200. package/dist/sale_portal/.kosh/schema.d.ts +736 -0
  201. package/dist/sale_portal/index.d.ts +9 -0
  202. package/dist/sale_portal/index.js +71 -0
  203. package/dist/sale_portal/module.d.ts +2718 -0
  204. package/dist/sale_portal/module.js +19 -0
  205. package/dist/sale_project/.kosh/bindings.js +1 -1
  206. package/dist/sale_project/.kosh/schema.d.ts +15 -4
  207. package/dist/sale_project/module.d.ts +390 -10
  208. package/dist/sales/.kosh/bindings.js +1 -1
  209. package/dist/sales/.kosh/schema.d.ts +15 -4
  210. package/dist/sales/demo.js +3 -3
  211. package/dist/sales/index.js +67 -1
  212. package/dist/sales/module.d.ts +232 -8
  213. package/dist/sales/module.js +51 -12
  214. package/dist/server/auth/base.js +2 -0
  215. package/dist/server/auth/service.d.ts +2 -0
  216. package/dist/server/auth/service.js +7 -1
  217. package/dist/server/index.d.ts +1 -1
  218. package/dist/server/index.js +1 -1
  219. package/dist/server/server.js +26 -1
  220. package/dist/ui/api.d.ts +2 -0
  221. package/dist/ui/app.js +1 -1
  222. package/dist/ui/context.d.ts +3 -1
  223. package/dist/ui/context.js +2 -2
  224. package/dist/ui/index.d.ts +1 -1
  225. package/dist/ui/index.js +1 -1
  226. package/dist/ui/lib/format.d.ts +2 -0
  227. package/dist/ui/lib/format.js +3 -1
  228. package/dist/ui/views/FormView.js +19 -6
  229. package/package.json +50 -2
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The Mushak documents (RFC 0016 §5.3), as document templates (RFC 0005): the tax invoice (Mushak 6.3), the credit
3
+ * note (Mushak 6.7) and the debit note (Mushak 6.8) on invoices, and the certificate of VAT deducted at source (Mushak 6.6) on payments.
4
+ * Seller and buyer with their BIN, each line's value, SD and VAT, the totals in words. Like every template, they are
5
+ * the company's to change in the designer.
6
+ */
7
+ import type { DocumentSpec } from '../modules-sdk/index.js';
8
+ export declare const MUSHAK_DOCUMENTS: readonly DocumentSpec[];
@@ -0,0 +1,183 @@
1
+ const parties = (seller, buyer) => ({
2
+ kind: 'columns',
3
+ id: 'parties',
4
+ left: [
5
+ {
6
+ kind: 'fields',
7
+ id: 'seller',
8
+ items: [
9
+ { label: seller, bind: 'company.name' },
10
+ { label: `${seller}'s BIN`, bind: 'company.bin' },
11
+ ],
12
+ },
13
+ ],
14
+ right: [
15
+ {
16
+ kind: 'fields',
17
+ id: 'buyer',
18
+ items: [
19
+ { label: buyer, bind: 'partner.name' },
20
+ { label: `${buyer}'s BIN`, bind: 'partner.bin' },
21
+ { label: 'Address', bind: 'partner.street' },
22
+ { label: 'City', bind: 'partner.city' },
23
+ ],
24
+ },
25
+ ],
26
+ });
27
+ const lines = {
28
+ kind: 'table',
29
+ id: 'lines',
30
+ bind: 'invoiceLines',
31
+ columns: [
32
+ { label: 'Description', bind: 'name' },
33
+ { label: 'Quantity', bind: 'quantity', align: 'end' },
34
+ { label: 'Unit price', bind: 'priceUnit', align: 'end' },
35
+ { label: 'Value', bind: 'subtotal', align: 'end', sum: true },
36
+ { label: 'SD', bind: 'sdAmount', align: 'end', sum: true },
37
+ { label: 'VAT', bind: 'vatAmount', align: 'end', sum: true },
38
+ { label: 'Total with taxes', bind: 'totalWithTaxes', align: 'end', sum: true },
39
+ ],
40
+ };
41
+ const totals = {
42
+ kind: 'fields',
43
+ id: 'totals',
44
+ columns: 3,
45
+ items: [
46
+ { label: 'Value', bind: 'amountUntaxed' },
47
+ { label: 'SD and VAT', bind: 'amountTax' },
48
+ { label: 'Total', bind: 'amountTotal' },
49
+ ],
50
+ };
51
+ const signature = {
52
+ kind: 'signature',
53
+ id: 'signature',
54
+ labels: ['Authorised person: name, designation and signature'],
55
+ };
56
+ export const MUSHAK_DOCUMENTS = [
57
+ {
58
+ key: 'mushak_6_3',
59
+ name: 'Tax invoice (Mushak 6.3)',
60
+ model: 'account.move',
61
+ layout: {
62
+ paper: 'A4',
63
+ header: '{{company.name}} · BIN {{company.bin}}',
64
+ footer: 'Mushak 6.3 · Page {{page}} of {{pages}}',
65
+ blocks: [
66
+ { kind: 'heading', id: 'title', text: 'Tax invoice', level: 1 },
67
+ { kind: 'text', id: 'form', text: 'Mushak 6.3' },
68
+ parties('Seller', 'Buyer'),
69
+ {
70
+ kind: 'fields',
71
+ id: 'invoice',
72
+ columns: 3,
73
+ items: [
74
+ { label: 'Invoice number', bind: 'name' },
75
+ { label: 'Date of issue', bind: 'date' },
76
+ { label: 'Time of issue', bind: 'postedAt' },
77
+ ],
78
+ },
79
+ lines,
80
+ totals,
81
+ { kind: 'text', id: 'in_words', text: 'In words: {{amountTotal|words}}' },
82
+ signature,
83
+ ],
84
+ },
85
+ },
86
+ {
87
+ key: 'mushak_6_7',
88
+ name: 'Credit note (Mushak 6.7)',
89
+ model: 'account.move',
90
+ layout: {
91
+ paper: 'A4',
92
+ header: '{{company.name}} · BIN {{company.bin}}',
93
+ footer: 'Mushak 6.7 · Page {{page}} of {{pages}}',
94
+ blocks: [
95
+ { kind: 'heading', id: 'title', text: 'Credit note', level: 1 },
96
+ { kind: 'text', id: 'form', text: 'Mushak 6.7' },
97
+ parties('Seller', 'Buyer'),
98
+ {
99
+ kind: 'fields',
100
+ id: 'note',
101
+ columns: 3,
102
+ items: [
103
+ { label: 'Credit note number', bind: 'name' },
104
+ { label: 'Date of issue', bind: 'date' },
105
+ { label: 'Tax invoice it corrects', bind: 'reversalOf.name' },
106
+ ],
107
+ },
108
+ { kind: 'field', id: 'reason', label: 'Reason', bind: 'ref' },
109
+ lines,
110
+ totals,
111
+ { kind: 'text', id: 'in_words', text: 'In words: {{amountTotal|words}}' },
112
+ signature,
113
+ ],
114
+ },
115
+ },
116
+ {
117
+ key: 'mushak_6_8',
118
+ name: 'Debit note (Mushak 6.8)',
119
+ model: 'account.move',
120
+ layout: {
121
+ paper: 'A4',
122
+ header: '{{company.name}} · BIN {{company.bin}}',
123
+ footer: 'Mushak 6.8 · Page {{page}} of {{pages}}',
124
+ blocks: [
125
+ { kind: 'heading', id: 'title', text: 'Debit note', level: 1 },
126
+ { kind: 'text', id: 'form', text: 'Mushak 6.8' },
127
+ parties('Seller', 'Buyer'),
128
+ {
129
+ kind: 'fields',
130
+ id: 'note',
131
+ columns: 3,
132
+ items: [
133
+ { label: 'Debit note number', bind: 'name' },
134
+ { label: 'Date of issue', bind: 'date' },
135
+ { label: 'Tax invoice it adds to', bind: 'debitOf.name' },
136
+ ],
137
+ },
138
+ { kind: 'field', id: 'reason', label: 'Reason', bind: 'ref' },
139
+ lines,
140
+ totals,
141
+ { kind: 'text', id: 'in_words', text: 'In words: {{amountTotal|words}}' },
142
+ signature,
143
+ ],
144
+ },
145
+ },
146
+ {
147
+ key: 'mushak_6_6',
148
+ name: 'Certificate of VAT deducted at source (Mushak 6.6)',
149
+ model: 'account.payment',
150
+ layout: {
151
+ paper: 'A4',
152
+ header: '{{company.name}} · BIN {{company.bin}}',
153
+ footer: 'Mushak 6.6 · Page {{page}} of {{pages}}',
154
+ blocks: [
155
+ { kind: 'heading', id: 'title', text: 'Certificate of VAT deducted at source', level: 1 },
156
+ { kind: 'text', id: 'form', text: 'Mushak 6.6' },
157
+ parties('Withholding entity', 'Supplier'),
158
+ {
159
+ kind: 'fields',
160
+ id: 'payment',
161
+ columns: 3,
162
+ items: [
163
+ { label: 'Certificate number', bind: 'name' },
164
+ { label: 'Date', bind: 'date' },
165
+ { label: 'Paid', bind: 'amount' },
166
+ ],
167
+ },
168
+ {
169
+ kind: 'table',
170
+ id: 'withheld',
171
+ bind: 'withholdings',
172
+ columns: [
173
+ { label: 'Deduction', bind: 'withholding.name' },
174
+ { label: 'On', bind: 'base', align: 'end' },
175
+ { label: 'Deducted', bind: 'amount', align: 'end', sum: true },
176
+ ],
177
+ },
178
+ { kind: 'text', id: 'in_words', text: 'Deducted: {{amountWithheld|words}}' },
179
+ signature,
180
+ ],
181
+ },
182
+ },
183
+ ];
@@ -0,0 +1,8 @@
1
+ import { type KoshModule, type LocalizationSpec } from '../modules-sdk/index.js';
2
+ export { MUSHAK_DOCUMENTS } from './documents.js';
3
+ export { CompanyIdentifiers, LineMushak, l10nBdShutro, MUSHAK_KINDS, type MushakKind, mushakAmounts, PartnerIdentifiers, TAXES, TaxMushak, } from './module.js';
4
+ export { type Band, MonthError, monthRange, type RegisterRow, type Return91, register, return91, type Side, VAT_CATEGORIES, type VatCategory, } from './mushak.js';
5
+ export { type MushakForm, registerMushakRoutes } from './routes.js';
6
+ /** Bangladesh, as Accounting installs it for a company. */
7
+ export declare const BANGLADESH: LocalizationSpec;
8
+ export declare const l10nBd: KoshModule;
@@ -0,0 +1,156 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * `shutro-erp/l10n_bd` (RFC 0016 §5.3): Kosh for a company in Bangladesh. Installing it sets each company without a chart
4
+ * up for the country: the chart of accounts (output and input VAT, VAT payable, advance tax, supplementary duty,
5
+ * AIT, TDS and VDS), the accounts of the VAT, SD and AT taxes, the VDS and TDS withholdings, a July–June fiscal year
6
+ * and lakh / crore grouping. Contacts and companies get their BIN and TIN, checked.
7
+ *
8
+ * Rates are those of the VAT and Supplementary Duty Act 2012 and the income tax rules as commonly applied; the
9
+ * withholding rates in particular change with each Finance Act: check them in Accounting › Configuration.
10
+ */
11
+ import { accounting, COMMON_ACCOUNTS, DEFAULT_ACCOUNTS, installedChart, installLocalization, } from '../accounting/index.js';
12
+ import { contacts } from '../contacts/index.js';
13
+ import { defineModule } from '../modules-sdk/index.js';
14
+ import { field } from '../views/index.js';
15
+ import { MUSHAK_DOCUMENTS } from './documents.js';
16
+ import { l10nBdShutro } from './module.js';
17
+ import { registerMushakRoutes } from './routes.js';
18
+ export { MUSHAK_DOCUMENTS } from './documents.js';
19
+ export { CompanyIdentifiers, LineMushak, l10nBdShutro, MUSHAK_KINDS, mushakAmounts, PartnerIdentifiers, TAXES, TaxMushak, } from './module.js';
20
+ export { MonthError, monthRange, register, return91, VAT_CATEGORIES, } from './mushak.js';
21
+ export { registerMushakRoutes } from './routes.js';
22
+ /** Bangladesh, as Accounting installs it for a company. */
23
+ export const BANGLADESH = {
24
+ key: 'bd',
25
+ country: 'BD',
26
+ label: 'Bangladesh',
27
+ chart: {
28
+ accounts: [
29
+ ...COMMON_ACCOUNTS,
30
+ // VAT and SD Act 2012 (Mushak): output and input VAT, the net payable, advance tax, supplementary duty.
31
+ { code: '2200', name: 'Output VAT (Mushak)', type: 'liability_current' },
32
+ { code: '1300', name: 'Input VAT (Mushak)', type: 'asset_current' },
33
+ { code: '2210', name: 'VAT payable', type: 'liability_current' },
34
+ { code: '1310', name: 'Advance tax (AT) receivable', type: 'asset_current' },
35
+ { code: '2220', name: 'Supplementary duty (SD) payable', type: 'liability_current' },
36
+ { code: '1320', name: 'Advance income tax (AIT) receivable', type: 'asset_current' },
37
+ { code: '2230', name: 'Tax deducted at source (TDS) payable', type: 'liability_current' },
38
+ { code: '2240', name: 'VAT deducted at source (VDS) payable', type: 'liability_current' },
39
+ ],
40
+ defaults: DEFAULT_ACCOUNTS,
41
+ taxAccounts: { sale: '2200', purchase: '1300' },
42
+ },
43
+ taxes: {
44
+ 'l10n_bd.tax_sale_vat15': '2200',
45
+ 'l10n_bd.tax_sale_vat10': '2200',
46
+ 'l10n_bd.tax_sale_vat7_5': '2200',
47
+ 'l10n_bd.tax_sale_vat5': '2200',
48
+ 'l10n_bd.tax_sale_exempt': '2200',
49
+ 'l10n_bd.tax_sale_zero': '2200',
50
+ 'l10n_bd.tax_purchase_vat15': '1300',
51
+ 'l10n_bd.tax_purchase_vat5': '1300',
52
+ 'l10n_bd.tax_purchase_exempt': '1300',
53
+ 'l10n_bd.tax_sale_sd10': '2220',
54
+ 'l10n_bd.tax_sale_sd20': '2220',
55
+ 'l10n_bd.tax_sale_sd30': '2220',
56
+ 'l10n_bd.tax_sale_sd45': '2220',
57
+ 'l10n_bd.tax_purchase_at5': '1310',
58
+ },
59
+ withholdings: [
60
+ // VDS: a withholding entity keeps back the VAT of a bill and pays it to the NBR (Mushak 6.6).
61
+ { name: 'VDS (the full VAT)', direction: 'vendor', base: 'tax', rate: '1', account: '2240' },
62
+ // TDS (income tax at source) on payments to suppliers and for services: typical rates.
63
+ {
64
+ name: 'TDS 5% (supplies)',
65
+ direction: 'vendor',
66
+ base: 'untaxed',
67
+ rate: '0.05',
68
+ account: '2230',
69
+ },
70
+ {
71
+ name: 'TDS 10% (services)',
72
+ direction: 'vendor',
73
+ base: 'untaxed',
74
+ rate: '0.10',
75
+ account: '2230',
76
+ },
77
+ // What customers deduct from our invoices as advance income tax.
78
+ {
79
+ name: 'AIT deducted by customers 3%',
80
+ direction: 'customer',
81
+ base: 'untaxed',
82
+ rate: '0.03',
83
+ account: '1320',
84
+ },
85
+ ],
86
+ fiscalYearStart: 7,
87
+ grouping: 'lakh',
88
+ };
89
+ /** Sets up the company of `env` for Bangladesh when it has no chart yet, or completes a Bangladesh setup. */
90
+ async function localize(raw) {
91
+ // Accounting's environment: the installer reads Accounting's models.
92
+ const env = raw;
93
+ const companies = await env
94
+ .model('res.company')
95
+ .search({ where: { id: env.companyRef }, limit: 1 });
96
+ if (companies.length === 0)
97
+ return undefined; // no company yet (before installBase)
98
+ const chart = await installedChart(env);
99
+ if (chart !== null && chart !== BANGLADESH.key)
100
+ return undefined; // another chart: the company's choice
101
+ const done = await installLocalization(env, BANGLADESH);
102
+ return done.chart === null
103
+ ? undefined
104
+ : `the Bangladesh chart (${done.chart.accounts} accounts), ${done.taxes} taxes, ${done.withholdings} withholdings`;
105
+ }
106
+ export const l10nBd = defineModule({
107
+ shutro: l10nBdShutro,
108
+ kosh: '^0.1.0',
109
+ depends: [accounting, contacts],
110
+ accessLevels: {
111
+ manager: { label: 'Bangladesh localization', groups: ['account.manager'] },
112
+ },
113
+ localization: BANGLADESH,
114
+ // The tax invoice, the credit note and the VDS certificate (printed when Reporting is installed).
115
+ documents: MUSHAK_DOCUMENTS,
116
+ hooks: { defaults: (env) => localize(env) },
117
+ routes: registerMushakRoutes,
118
+ // Accounting › Reporting › Mushak returns: the registers and the monthly return.
119
+ actions: {
120
+ 'l10n_bd.action_mushak': {
121
+ type: 'client',
122
+ page: 'l10n_bd.Mushak',
123
+ label: 'Mushak returns',
124
+ visibleTo: ['account.user'],
125
+ },
126
+ },
127
+ menus: [
128
+ {
129
+ id: 'l10n_bd.mushak',
130
+ parent: 'accounting.reporting',
131
+ label: 'Mushak returns',
132
+ action: 'l10n_bd.action_mushak',
133
+ sequence: 8,
134
+ },
135
+ ],
136
+ // The BIN and TIN with a contact's identity, for contacts in Bangladesh.
137
+ viewExtensions: [
138
+ // Where a tax goes in the Mushak returns.
139
+ {
140
+ view: 'account.tax.form',
141
+ operations: [{ append: 'main', nodes: [field({ field: 'mushak', id: 'mushak' })] }],
142
+ },
143
+ {
144
+ view: 'res.partner.form',
145
+ operations: [
146
+ {
147
+ append: 'identity',
148
+ nodes: [
149
+ field({ field: 'bin', id: 'bin', visibleWhen: { country: 'BD' } }),
150
+ field({ field: 'tin', id: 'tin', visibleWhen: { country: 'BD' } }),
151
+ ],
152
+ },
153
+ ],
154
+ },
155
+ ],
156
+ });