Skip to content

Commit

Permalink
fix: pan doc consistent with GSTIN
Browse files Browse the repository at this point in the history
(cherry picked from commit 1c125a9)
  • Loading branch information
vorasmit authored and mergify[bot] committed Aug 22, 2024
1 parent f5f87c0 commit 531efe2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
4 changes: 3 additions & 1 deletion india_compliance/gst_india/doctype/pan/pan.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2024, Resilient Tech and contributors
// For license information, please see license.txt

frappe.ui.form.on("Pan", {
frappe.ui.form.on("PAN", {
refresh(frm) {
frm.disable_form();

frm.add_custom_button(__("Refresh PAN Status"), () => {
frm.call("update_pan_status");
});
Expand Down
39 changes: 28 additions & 11 deletions india_compliance/gst_india/doctype/pan/pan.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:pan",
"creation": "2024-07-31 13:10:35.277697",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"pan",
"pan_status",
"column_break_hzzp",
"last_updated_on"
],
"fields": [
{
"fieldname": "pan",
"fieldtype": "Data",
"label": "Pan"
"in_list_view": 1,
"label": "Pan",
"reqd": 1,
"unique": 1
},
{
"fieldname": "pan_status",
Expand All @@ -24,31 +28,44 @@
"fieldname": "last_updated_on",
"fieldtype": "Datetime",
"label": "Last Updated On"
},
{
"fieldname": "column_break_hzzp",
"fieldtype": "Column Break"
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-08-07 15:04:50.116211",
"modified": "2024-08-08 14:01:44.876614",
"modified_by": "Administrator",
"module": "GST India",
"name": "Pan",
"name": "PAN",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
"share": 1
},
{
"export": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"share": 1
},
{
"export": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"share": 1
}
],
"read_only": 1,
"sort_field": "creation",
"sort_order": "DESC",
"states": []
Expand Down
10 changes: 5 additions & 5 deletions india_compliance/gst_india/doctype/pan/pan.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
inverse_table = [0, 4, 3, 2, 1, 5, 6, 7, 8, 9]


class Pan(Document):
class PAN(Document):
@frappe.whitelist()
def update_pan_status(self):
fetch_and_update_pan_status(self.pan, True)
Expand All @@ -50,7 +50,7 @@ def before_save(self):
@frappe.whitelist()
def get_pan_status(pan, force_update=False):
if not force_update and (
pan_status := frappe.db.get_value("Pan", pan, ["pan_status", "last_updated_on"])
pan_status := frappe.db.get_value("PAN", pan, ["pan_status", "last_updated_on"])
):
return pan_status

Expand Down Expand Up @@ -81,10 +81,10 @@ def fetch_and_update_pan_status(pan, throw):
return

# Update PAN status
if docname := frappe.db.exists("Pan", pan):
doc = frappe.get_doc("Pan", docname)
if docname := frappe.db.exists("PAN", pan):
doc = frappe.get_doc("PAN", docname)
else:
doc = frappe.new_doc("Pan")
doc = frappe.new_doc("PAN")

doc.update(
{
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/gst_india/doctype/pan/test_pan.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
from frappe.tests.utils import FrappeTestCase


class TestPan(FrappeTestCase):
class TestPAN(FrappeTestCase):
pass

0 comments on commit 531efe2

Please sign in to comment.