From 532903fef50c7474545817f3b461f243dc97ea00 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Fri, 9 Aug 2024 18:40:28 +0530 Subject: [PATCH 1/3] fix: make period field mandatory --- .../purchase_reconciliation_tool.js | 7 ++++++- .../purchase_reconciliation_tool.json | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js index 92fd0e000..28df9ecaf 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js @@ -88,7 +88,12 @@ frappe.ui.form.on("Purchase Reconciliation Tool", { refresh(frm) { // Primary Action frm.disable_save(); - frm.page.set_primary_action(__("Reconcile"), () => frm.save()); + frm.page.set_primary_action(__("Reconcile"), () => { + if (!frm.doc.company && !frm.doc.company_gstin) { + frappe.throw(__('Please provide either a Company name or Company GSTIN.')); + } + frm.save(); + }); // add custom buttons api_enabled diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.json b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.json index 4acc2f59e..59ca56ed3 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.json +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.json @@ -47,7 +47,8 @@ "fieldname": "purchase_period", "fieldtype": "Select", "label": "Purchase Period", - "options": "\nThis Month\nThis Quarter to Last Month\nThis Quarter\nThis Fiscal Year to Last Month\nThis Fiscal Year\nLast Month\nLast Quarter\nLast Fiscal Year\nCustom" + "options": "\nThis Month\nThis Quarter to Last Month\nThis Quarter\nThis Fiscal Year to Last Month\nThis Fiscal Year\nLast Month\nLast Quarter\nLast Fiscal Year\nCustom", + "reqd": 1 }, { "depends_on": "eval: doc.purchase_period == 'Custom'", @@ -71,7 +72,8 @@ "fieldname": "inward_supply_period", "fieldtype": "Select", "label": "Inward Supply Period", - "options": "\nThis Month\nThis Quarter to Last Month\nThis Quarter\nThis Fiscal Year to Last Month\nThis Fiscal Year\nLast Month\nLast Quarter\nLast Fiscal Year\nCustom" + "options": "\nThis Month\nThis Quarter to Last Month\nThis Quarter\nThis Fiscal Year to Last Month\nThis Fiscal Year\nLast Month\nLast Quarter\nLast Fiscal Year\nCustom", + "reqd": 1 }, { "depends_on": "eval: doc.inward_supply_period == 'Custom'", @@ -150,7 +152,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2024-06-20 13:19:57.316043", + "modified": "2024-08-09 17:57:55.801686", "modified_by": "Administrator", "module": "GST India", "name": "Purchase Reconciliation Tool", From 2f0494dbaa98108e59a1318b5e9a4222bfd9b3c3 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Sat, 10 Aug 2024 11:14:43 +0530 Subject: [PATCH 2/3] fix: add mandatory field in test case --- .../test_purchase_reconciliation_tool.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/test_purchase_reconciliation_tool.py b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/test_purchase_reconciliation_tool.py index 87252dcfc..ab037f98f 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/test_purchase_reconciliation_tool.py +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/test_purchase_reconciliation_tool.py @@ -82,8 +82,10 @@ def test_purchase_reconciliation_tool(self): { "company": "_Test Indian Registered Company", "company_gstin": "All", + "purchase_period": "Custom", "purchase_from_date": "2023-11-01", "purchase_to_date": "2023-12-31", + "inward_supply_period": "Custom", "inward_supply_from_date": "2023-11-01", "inward_supply_to_date": "2023-12-31", "gst_return": "GSTR 2B", From 4123ec2ffbe316fdddbbce1856707533e219a911 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Thu, 22 Aug 2024 12:50:01 +0530 Subject: [PATCH 3/3] fix(pur reco): ensure that latest purchae period is selected onload --- .../purchase_reconciliation_tool.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js index 28df9ecaf..5bddf1277 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js @@ -75,7 +75,9 @@ frappe.ui.form.on("Purchase Reconciliation Tool", { onload(frm) { if (frm.doc.is_modified) frm.doc.reconciliation_data = null; add_gstr2b_alert(frm); - set_date_range_description(frm); + + frm.trigger("purchase_period"); + frm.trigger("inward_supply_period"); }, async company(frm) {