mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 05:59:18 +00:00
chore: remove unwanted fields
This commit is contained in:
@@ -9,13 +9,11 @@
|
|||||||
"section_break_2",
|
"section_break_2",
|
||||||
"client_id",
|
"client_id",
|
||||||
"client_secret",
|
"client_secret",
|
||||||
"public_key_file",
|
|
||||||
"public_key",
|
"public_key",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"gstin",
|
"gstin",
|
||||||
"username",
|
"username",
|
||||||
"password",
|
"password",
|
||||||
"auto_refresh_token",
|
|
||||||
"auth_token",
|
"auth_token",
|
||||||
"token_expiry",
|
"token_expiry",
|
||||||
"sek"
|
"sek"
|
||||||
@@ -45,12 +43,6 @@
|
|||||||
"label": "Client Secret",
|
"label": "Client Secret",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "public_key_file",
|
|
||||||
"fieldtype": "Attach",
|
|
||||||
"label": "Public Key",
|
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "public_key",
|
"fieldname": "public_key",
|
||||||
"fieldtype": "Long Text",
|
"fieldtype": "Long Text",
|
||||||
@@ -79,36 +71,30 @@
|
|||||||
"label": "Password",
|
"label": "Password",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"default": "0",
|
|
||||||
"description": "Token will be automatically refreshed 10 mins before expiry",
|
|
||||||
"fieldname": "auto_refresh_token",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"label": "Auto Refresh Token"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "auth_token",
|
"fieldname": "auth_token",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "token_expiry",
|
|
||||||
"fieldtype": "Datetime",
|
|
||||||
"hidden": 1,
|
|
||||||
"read_only": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "sek",
|
"fieldname": "sek",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "token_expiry",
|
||||||
|
"fieldtype": "Datetime",
|
||||||
|
"hidden": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-10-23 19:55:11.417161",
|
"modified": "2020-11-03 21:23:50.277305",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Regional",
|
"module": "Regional",
|
||||||
"name": "E Invoice Settings",
|
"name": "E Invoice Settings",
|
||||||
|
|||||||
@@ -3,26 +3,7 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
|
||||||
from frappe import _
|
|
||||||
from frappe.utils.data import cstr
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
|
||||||
|
|
||||||
class EInvoiceSettings(Document):
|
class EInvoiceSettings(Document):
|
||||||
def validate(self):
|
pass
|
||||||
mandatory_fields = ['client_id', 'client_secret', 'gstin', 'username', 'password', 'public_key_file']
|
|
||||||
for d in mandatory_fields:
|
|
||||||
if not self.get(d):
|
|
||||||
frappe.throw(_("{} is required").format(frappe.unscrub(d)), title=_("Missing Values"))
|
|
||||||
|
|
||||||
def before_save(self):
|
|
||||||
previous = self.get_doc_before_save()
|
|
||||||
public_file_changed = previous.get('public_key_file') != self.get('public_key_file') if previous else True
|
|
||||||
if not self.public_key or public_file_changed:
|
|
||||||
self.public_key = self.read_key_file()
|
|
||||||
|
|
||||||
def read_key_file(self):
|
|
||||||
key_file = frappe.get_doc('File', dict(attached_to_name=self.doctype))
|
|
||||||
with open(key_file.get_full_path(), 'rb') as f:
|
|
||||||
return cstr(f.read())
|
|
||||||
|
|||||||
Reference in New Issue
Block a user