Skip to content

Commit

Permalink
Merge pull request #2510 from Sanket322/mandatory_period_in_purchase_…
Browse files Browse the repository at this point in the history
…reco

fix: make purchase reconciliation period mandatory
  • Loading branch information
vorasmit authored Aug 22, 2024
2 parents 48572d2 + 4123ec2 commit 62e8398
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -88,7 +90,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand All @@ -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'",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 62e8398

Please sign in to comment.