diff --git a/india_compliance/gst_india/constants/custom_fields.py b/india_compliance/gst_india/constants/custom_fields.py index 5d80dc2260..69b23b07ae 100644 --- a/india_compliance/gst_india/constants/custom_fields.py +++ b/india_compliance/gst_india/constants/custom_fields.py @@ -899,36 +899,6 @@ "print_hide": 1, "no_copy": 1, }, - { - "fieldname": "transporter_name", - "label": "Transporter Name", - "fieldtype": "Small Text", - "insert_after": "lr_no", - "fetch_from": "transporter.supplier_name", - "read_only": 1, - "print_hide": 1, - "no_copy": 1, - "translatable": 0, - }, - { - "fieldname": "lr_no", - "label": "Transport Receipt No", - "fieldtype": "Data", - "insert_after": "column_break5", - "print_hide": 1, - "no_copy": 1, - "translatable": 0, - "length": 30, - }, - { - "fieldname": "lr_date", - "label": "Transport Receipt Date", - "fieldtype": "Date", - "insert_after": "lr_no", - "default": "Today", - "print_hide": 1, - "no_copy": 1, - }, { "fieldname": "driver", "label": "Driver", diff --git a/india_compliance/gst_india/doctype/gst_settings/gst_settings.json b/india_compliance/gst_india/doctype/gst_settings/gst_settings.json index 3cea7b3144..3ada2a4219 100644 --- a/india_compliance/gst_india/doctype/gst_settings/gst_settings.json +++ b/india_compliance/gst_india/doctype/gst_settings/gst_settings.json @@ -375,6 +375,7 @@ }, { "default": "0", + "depends_on": "eval: doc.enable_e_waybill", "fieldname": "enable_e_waybill_from_pr", "fieldtype": "Check", "label": "Enable e-Waybill Generation from Purchase Receipt" @@ -383,7 +384,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2023-11-07 17:56:07.859891", + "modified": "2023-11-29 17:29:51.606431", "modified_by": "Administrator", "module": "GST India", "name": "GST Settings", diff --git a/india_compliance/gst_india/setup/property_setters.py b/india_compliance/gst_india/setup/property_setters.py index e3390253d9..9d2d8dd7bc 100644 --- a/india_compliance/gst_india/setup/property_setters.py +++ b/india_compliance/gst_india/setup/property_setters.py @@ -100,6 +100,9 @@ def get_property_setters(): "property": "default_email_template", "value": "Purchase Reconciliation", }, + *TRANSPORTER_NAME_PROPERTIES, + *LR_NO_PROPERTIES, + *LR_DATE_PROPERTIES, ] @@ -120,3 +123,102 @@ def get_options_property_setter(doctype, fieldname, new_options, prepend=True): "property": "options", "value": options, } + + +TRANSPORTER_NAME_PROPERTIES = [ + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "transporter_name", + "property": "fieldtype", + "property_type": "Select", + "value": "Small Text", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "transporter_name", + "property": "fetch_from", + "property_type": "Small Text", + "value": "transporter.supplier_name", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "transporter_name", + "property": "no_copy", + "property_type": "Check", + "value": "1", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "transporter_name", + "property": "print_hide", + "property_type": "Check", + "value": "1", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "transporter_name", + "property": "read_only", + "property_type": "Check", + "value": "1", + }, +] + +LR_NO_PROPERTIES = [ + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "lr_no", + "property": "label", + "property_type": "Data", + "value": "Transport Receipt No", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "lr_no", + "property": "print_hide", + "property_type": "Check", + "value": "1", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "lr_no", + "property": "length", + "property_type": "Int", + "value": "30", + }, +] + + +LR_DATE_PROPERTIES = [ + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "lr_date", + "property": "label", + "property_type": "Data", + "value": "Transport Receipt Date", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "lr_date", + "property": "print_hide", + "property_type": "Check", + "value": "1", + }, + { + "doctype_or_field": "DocField", + "doctype": "Purchase Receipt", + "fieldname": "lr_date", + "property": "default", + "property_type": "Text", + "value": "Today", + }, +] diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index fd57687161..5b117c5a85 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -3,8 +3,8 @@ execute:import frappe; frappe.delete_doc_if_exists("DocType", "GSTIN") [post_model_sync] india_compliance.patches.v14.set_default_for_overridden_accounts_setting -execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #36 -execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #4 +execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #37 +execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #5 india_compliance.patches.post_install.remove_old_fields india_compliance.patches.post_install.update_company_gstin india_compliance.patches.post_install.update_custom_role_for_e_invoice_summary @@ -34,3 +34,4 @@ india_compliance.patches.v15.remove_ignore_reconciliation_field india_compliance.patches.post_install.update_company_fixtures #1 india_compliance.patches.post_install.update_itc_classification_field india_compliance.patches.v14.update_purchase_reco_email_template +india_compliance.patches.v14.delete_purchase_receipt_standard_custom_fields \ No newline at end of file diff --git a/india_compliance/patches/v14/delete_purchase_receipt_standard_custom_fields.py b/india_compliance/patches/v14/delete_purchase_receipt_standard_custom_fields.py new file mode 100644 index 0000000000..ab3fbe2993 --- /dev/null +++ b/india_compliance/patches/v14/delete_purchase_receipt_standard_custom_fields.py @@ -0,0 +1,17 @@ +import frappe + +FIELDS = [ + "transporter_name", + "lr_no", + "lr_date", +] + + +def execute(): + frappe.db.delete( + "Custom Field", + filters={ + "dt": "Purchase Receipt", + "fieldname": ("in", FIELDS), + }, + )