Skip to content

Commit 70ef0aa

Browse files
authored
Merge pull request #108 from 8848digital/16_oct_to_6_nov
16 oct to 6 nov
2 parents 8bc16a8 + c888635 commit 70ef0aa

9 files changed

Lines changed: 82 additions & 69 deletions

File tree

india_compliance/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "15.23.0"
1+
__version__ = "15.23.2"

india_compliance/gst_india/doctype/gstr_1_beta/gstr_1_beta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2967,7 +2967,7 @@ class GSTR1Action extends FileGSTR1Dialog {
29672967
// summary matched
29682968
if (filing_status == "Ready to File") {
29692969
// only show filed tab
2970-
["books", "unfiled", "reconcile"].map(tab =>
2970+
["books", "unfiled", "reconcile", "errors"].map(tab =>
29712971
this.frm.gstr1.tabs[`${tab}_tab`].hide()
29722972
);
29732973
this.frm.gstr1.tabs.filed_tab.set_active();

india_compliance/gst_india/doctype/gstr_3b_report/gstr_3b_report.py

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -350,35 +350,28 @@ def set_reclaim_of_itc_reversal(self):
350350
self.report_dict["itc_elg"]["itc_inelg"][0][tax_amount_key] += entry.amount
351351

352352
def get_inward_nil_exempt(self, state):
353-
PurchaseInvoice = frappe.qb.DocType("Purchase Invoice")
354-
PurchaseInvoiceItem = frappe.qb.DocType("Purchase Invoice Item")
355-
356-
query = (
357-
frappe.qb.from_(PurchaseInvoice)
358-
.join(PurchaseInvoiceItem)
359-
.on(PurchaseInvoice.name == PurchaseInvoiceItem.parent)
360-
.select(
361-
PurchaseInvoice.place_of_supply,
362-
PurchaseInvoice.supplier_address,
363-
PurchaseInvoiceItem.taxable_value,
364-
PurchaseInvoiceItem.gst_treatment,
365-
)
366-
.where(
367-
(PurchaseInvoice.docstatus == 1)
368-
& (PurchaseInvoice.is_opening == "No")
369-
& (PurchaseInvoice.company_gstin != IfNull(PurchaseInvoice.supplier_gstin, ""))
370-
& (
371-
(PurchaseInvoiceItem.gst_treatment != "Taxable")
372-
| (PurchaseInvoice.gst_category == "Registered Composition")
373-
)
374-
& (PurchaseInvoice.posting_date.between(self.from_date, self.to_date))
375-
& (PurchaseInvoice.company == self.company)
376-
& (PurchaseInvoice.company_gstin == self.gst_details.get("gstin"))
377-
)
353+
inward_nil_exempt = frappe.db.sql(
354+
"""
355+
SELECT p.place_of_supply, p.supplier_address,
356+
i.taxable_value, i.gst_treatment
357+
FROM `tabPurchase Invoice` p , `tabPurchase Invoice Item` i
358+
WHERE p.docstatus = 1 and p.name = i.parent
359+
and p.is_opening = 'No'
360+
and p.company_gstin != IFNULL(p.supplier_gstin, "")
361+
and (i.gst_treatment != 'Taxable' or p.gst_category = 'Registered Composition') and
362+
p.posting_date between %s and %s
363+
and p.company = %s and p.company_gstin = %s
364+
and p.gst_category != "Overseas"
365+
""",
366+
(
367+
self.from_date,
368+
self.to_date,
369+
self.company,
370+
self.gst_details.get("gstin"),
371+
),
372+
as_dict=1,
378373
)
379374

380-
inward_nil_exempt = query.run(as_dict=True)
381-
382375
inward_nil_exempt_details = {
383376
"gst": {"intra": 0.0, "inter": 0.0},
384377
"non_gst": {"intra": 0.0, "inter": 0.0},
@@ -391,7 +384,9 @@ def get_inward_nil_exempt(self, state):
391384
d.place_of_supply = "00-" + cstr(state)
392385

393386
supplier_state = address_state_map.get(d.supplier_address) or state
394-
is_intra_state = cstr(supplier_state) == cstr(d.place_of_supply.split("-")[1])
387+
is_intra_state = cstr(supplier_state) == cstr(
388+
d.place_of_supply.split("-")[1]
389+
)
395390
amount = flt(d.taxable_value, 2)
396391

397392
if d.gst_treatment != "Non-GST":

india_compliance/gst_india/report/gstr_3b_details/gstr_3b_details.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ def get_inward_nil_exempt(self):
431431
purchase_invoice.company_gstin
432432
!= IfNull(purchase_invoice.supplier_gstin, "")
433433
)
434+
& (purchase_invoice.gst_category != "Overseas")
434435
)
435436
.groupby(
436437
purchase_invoice.name,

india_compliance/gst_india/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ def create_notification(
10691069
"email_content": message_content.get("body"),
10701070
}
10711071
)
1072-
notification.insert()
1072+
notification.insert(ignore_permissions=True)
10731073

10741074

10751075
def enable_autocommit(fn):

india_compliance/gst_india/utils/e_invoice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def update_item_details(self, item_details, item):
685685
)
686686

687687
if self.doc.is_reverse_charge:
688-
item_details["total_value"] = item.taxable_value
688+
item_details["total_value"] = abs(self.rounded(item.taxable_value, 2))
689689

690690
if batch_no := self.sanitize_value(
691691
item.batch_no, max_length=20, truncate=False

india_compliance/public/js/setup_wizard.js

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function complete_setup_wizard() {
3030
method: "india_compliance.setup_wizard.enable_setup_wizard_complete",
3131
callback: function (r) {
3232
frappe.ui.toolbar.clear_cache();
33-
}
34-
})
33+
},
34+
});
3535
}
3636

3737
function toggle_india_specific_fields(country) {
@@ -60,37 +60,44 @@ function update_erpnext_slides_settings() {
6060
erpnext.setup?.slides_settings && erpnext.setup.slides_settings.slice(-1)[0];
6161
if (!slide) return;
6262

63-
company_gstin_field = {
64-
fieldname: "company_gstin",
65-
fieldtype: "Data",
66-
label: __("Company GSTIN"),
67-
};
63+
const gstin_section = [
64+
{
65+
fieldname: "company_gstin",
66+
fieldtype: "Data",
67+
label: __("Company GSTIN"),
68+
},
69+
{
70+
fieldtype: "Column Break",
71+
},
72+
{
73+
fieldname: "default_gst_rate",
74+
fieldtype: "Select",
75+
label: __("Default GST Rate"),
76+
options: [
77+
"0.0",
78+
"0.1",
79+
"0.25",
80+
"1.0",
81+
"1.5",
82+
"3.0",
83+
"5.0",
84+
"6.0",
85+
"7.5",
86+
"12.0",
87+
"18.0",
88+
"28.0",
89+
"40.0",
90+
],
91+
default: "18.0",
92+
},
93+
{
94+
fieldtype: "Section Break",
95+
},
96+
];
6897

69-
const _index = can_fetch_gstin_info() ? 0 : 1;
70-
71-
slide.fields.splice(_index, 0, company_gstin_field);
72-
73-
slide.fields.splice(4, 0, {
74-
fieldname: "default_gst_rate",
75-
fieldtype: "Select",
76-
label: __("Default GST Rate"),
77-
options: [
78-
"0.0",
79-
"0.1",
80-
"0.25",
81-
"1.0",
82-
"1.5",
83-
"3.0",
84-
"5.0",
85-
"6.0",
86-
"7.5",
87-
"12.0",
88-
"18.0",
89-
"28.0",
90-
"40.0",
91-
],
92-
default: "18.0",
93-
});
98+
const _index = can_fetch_gstin_info() ? 0 : 4;
99+
100+
slide.fields.splice(_index, 0, ...gstin_section);
94101

95102
slide.fields.push({
96103
fieldname: "enable_audit_trail",

india_compliance/public/js/taxes_controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ india_compliance.taxes_controller = class TaxesController {
139139
if (this.frm.doc.doctype === "Subcontracting Receipt") {
140140
amount = calculateAmount(row.qty, row.rate, "amount");
141141
} else if (this.frm.doc.doctype === "Stock Entry") {
142-
amount = calculateAmount(row.qty, row.basic_rate, "basic_amount");
142+
amount = calculateAmount(row.transfer_qty, row.basic_rate, "basic_amount");
143143
}
144144

145145
row.taxable_value = amount;
146+
this.frm.refresh_field("items");
146147
}
147148

148149
async update_tax_amount() {

india_compliance/public/js/utils.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,29 @@ Object.assign(india_compliance, {
268268
},
269269

270270
validate_gstin(gstin, show_msg = true) {
271+
const opts = { title: __("Error"), indicator: "red" };
272+
271273
if (!gstin || gstin.length !== 15) {
272-
if (show_msg) frappe.msgprint(__("GSTIN must be 15 characters long"));
274+
if (show_msg) {
275+
frappe.msgprint({
276+
message: __("GSTIN must be 15 characters long"),
277+
...opts,
278+
});
279+
}
273280
return;
274281
}
275282

276283
gstin = gstin.trim().toUpperCase();
277284

278285
if (GSTIN_REGEX.test(gstin) && is_gstin_check_digit_valid(gstin)) {
279286
return gstin;
280-
} else {
281-
if (show_msg) frappe.msgprint(__("Invalid GSTIN"));
287+
} else if (show_msg) {
288+
frappe.msgprint({
289+
message: __("Invalid GSTIN"),
290+
...opts,
291+
});
282292
}
283293
},
284-
285294
guess_gst_category(gstin, country) {
286295
if (!gstin) {
287296
if (country && country !== "India") return "Overseas";

0 commit comments

Comments
 (0)