diff --git a/propms/patches.txt b/propms/patches.txt index e69de29..45dc6d0 100755 --- a/propms/patches.txt +++ b/propms/patches.txt @@ -0,0 +1,2 @@ +propms.patches.custom_fields.custom_fields +propms.patches.custom_fields.custom_fields \ No newline at end of file diff --git a/propms/patches/custom_fields/custom_fields.py b/propms/patches/custom_fields/custom_fields.py new file mode 100644 index 0000000..8645c7d --- /dev/null +++ b/propms/patches/custom_fields/custom_fields.py @@ -0,0 +1,212 @@ +import frappe +from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + +def execute(): + fields={ + "Issue": [ + { + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "insert_after": "subject", + }, + { + "fieldname": "property_name", + "fieldtype": "Link", + "in_standard_filter": 1, + "insert_after": "column_break_4", + "label": "Property Name", + "options": "Property", + "reqd": 1, + }, + { + "fieldname": "section_break_15", + "fieldtype": "Section Break", + "insert_after": "customer", + }, + { + "fieldname": "person_in_charge", + "fieldtype": "Link", + "in_standard_filter": 1, + "insert_after": "section_break_15", + "label": "Person in charge", + "options": "Employee", + "reqd": 1, + }, + { + "fieldname": "sub_contractor_contact", + "fieldtype": "Link", + "insert_after": "person_in_charge", + "label": "Sub Contractor", + "options": "Supplier", + }, + { + "fieldname": "col_brk_001", + "fieldtype": "Column Break", + "insert_after": "sub_contractor_contact", + }, + { + "fetch_from": "person_in_charge.employee_name", + "fieldname": "person_in_charge_name", + "fieldtype": "Read Only", + "in_list_view": 1, + "insert_after": "col_brk_001", + "label": "Person In Charge Name", + }, + { + "fetch_from": "sub_contractor_contact.supplier_name", + "fieldname": "sub_contractor_name", + "fieldtype": "Read Only", + "insert_after": "person_in_charge_name", + "label": "Sub Contractor Name", + }, + { + "fieldname": "column_break_14", + "fieldtype": "Column Break", + "insert_after": "description", + }, + { + "fieldname": "defect_found", + "fieldtype": "Text Editor", + "insert_after": "column_break_14", + "label": "Defect Found", + }, + { + "fieldname": "material_request", + "fieldtype": "Section Break", + "insert_after": "defect_found", + "label": "Material Request", + }, + { + "fieldname": "materials_required", + "fieldtype": "Table", + "insert_after": "material_request", + "label": "Materials Required", + "options": "Issue Materials Detail", + }, + { + "fieldname": "materials_billed", + "fieldtype": "Table", + "insert_after": "materials_required", + "label": "Materials Billed", + "options": "Issue Materials Billed", + "read_only": 1, + }, + + { + "depends_on": "eval:!doc.__islocal", + "fieldname": "customer_feedback", + "fieldtype": "Text Editor", + "insert_after": "column_break1", + "label": "Customer Feedback", + }, + ], + "Issue Materials Detail": [ + { + "fieldname": "mateiral_request", + "fieldtype": "Link", + "insert_after": "material_status", + "label": "Mateiral Request", + "options": "Material Request", + }, + ], + "Quotation": [ + { + "fieldname": "cost_center", + "fieldtype": "Link", + "insert_after": "order_type", + "label": "Cost Center", + "options": "Cost Center", + }, + ], + "Material Request": [ + { + "fieldname": "sales_invoice", + "fieldtype": "Link", + "insert_after": "job_card", + "label": "Sales Invoice", + "options": "Sales Invoice", + }, + ], + "Material Request Item": [ + { + "fieldname": "material_request", + "fieldtype": "Data", + "insert_after": "page_break", + "label": "Material Request", + "translatable": 1, + }, + ], + "Item": [ + { + "description": "If the item requires Gas or Electricity or similar meter reading to charge the customer.", + "fieldname": "reading_required", + "fieldtype": "Check", + "insert_after": "is_sales_item", + "label": "Reading required", + }, + ], + "Company": [ + { + "fieldname": "property_management_settings", + "fieldtype": "Section Break", + "insert_after": "expenses_included_in_valuation", + "label": "Property Management Settings", + }, + { + "fieldname": "security_account_code", + "fieldtype": "Link", + "insert_after": "property_management_settings", + "label": "Security Account Code", + }, + { + "fieldname": "default_tax_account_head", + "fieldtype": "Link", + "insert_after": "security_account_code", + "label": "Default Tax Account Head", + }, + { + "fieldname": "default_tax_template", + "fieldtype": "Link", + "insert_after": "default_tax_account_head", + "label": "Default Tax Template", + "options": "Sales Taxes and Charges Template", + }, + { + "fieldname": "default_maintenance_tax_template", + "fieldtype": "Link", + "insert_after": "default_tax_template", + "label": "Default Maintenance Tax Template", + "options": "Sales Taxes and Charges Template", + }, + ], + "Sales Invoice": [ + { + "fieldname": "lease_information", + "fieldtype": "Section Break", + "insert_after": "select_print_heading", + "label": "Lease Information", + }, + { + "fieldname": "lease", + "fieldtype": "Link", + "insert_after": "lease_information", + "label": "Lease", + "options": "Lease", + }, + { + "fieldname": "lease_item", + "fieldtype": "Read Only", + "insert_after": "lease", + "label": "Lease Item", + }, + { + "fieldname": "job_card", + "fieldtype": "Link", + "insert_after": "lease_item", + "label": "Job Card", + "options": "Issue", + } + ] + } + create_custom_fields(fields, update=True) + \ No newline at end of file diff --git a/propms/patches/property_setter/property_setter.py b/propms/patches/property_setter/property_setter.py new file mode 100644 index 0000000..519b92e --- /dev/null +++ b/propms/patches/property_setter/property_setter.py @@ -0,0 +1,289 @@ +import frappe +from frappe.custom.doctype.property_setter.property_setter import make_property_setter + +def execute(): + properties = [ + { + "doctype": "Property", + "field_name": "status", + "property": "options", + "property_type": "Text", + "value": "Available\nBooked\nCommon Area (Not for lease)\nManaged for Customer\nOff lease in 3 months\nOn lease\nOn Sale\nRemoved\nRenewal\nSold\nVacating" + }, + { + "doctype": "Daily Checklist", + "property": "default_print_format", + "property_type": "Data", + "value": "Viva Daily Checklist" + }, + { + "doctype": "Journal Entry Account", + "field_name": "account", + "property": "columns", + "property_type": "Int", + "value": "2" + }, + { + "doctype": "Property", + "field_name": "identification_section", + "property": "bold", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Property", + "field_name": "section_break_4", + "property": "bold", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Property", + "field_name": "section_break_13", + "property": "bold", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Property", + "field_name": "section_break_22", + "property": "bold", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "section_break_7", + "property": "collapsible", + "property_type": "Check", + "value": "0" + }, + { + "doctype": "Issue", + "field_name": "section_break_19", + "property": "collapsible", + "property_type": "Check", + "value": "0" + }, + { + "doctype": "Issue", + "field_name": "raised_by", + "property": "report_hide", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "email_account", + "property": "report_hide", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "issue_type", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "priority", + "property": "in_standard_filter", + "property_type": "Check", + "value": "0" + }, + { + "doctype": "Lease", + "field_name": "property_owner", + "property": "in_list_view", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "customer", + "property": "in_list_view", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "start_date", + "property": "in_list_view", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "end_date", + "property": "in_list_view", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Unit Type", + "property": "search_fields", + "property_type": "Data", + "value": "unit_type" + }, + { + "doctype": "Issue", + "field_name": "opening_date", + "property": "in_list_view", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "raised_by", + "property": "in_list_view", + "property_type": "Check", + "value": "0" + }, + { + "doctype": "Issue", + "field_name": "issue_type", + "property": "reqd", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "status", + "property": "options", + "property_type": "Text", + "value": "Open\nIn Progress\nAwaiting Parts\nUnder Observation\nIn Discussion\nAppointment\nHold\nClosed" + }, + { + "doctype": "Contact", + "field_name": "department", + "property": "fieldtype", + "property_type": "Select", + "value": "Select" + }, + { + "doctype": "Contact", + "field_name": "department", + "property": "options", + "property_type": "Text", + "value": "\nOutsourcing - Cleaning" + }, + { + "doctype": "Material Request", + "field_name": "material_request_type", + "property": "options", + "property_type": "Text", + "value": "Material Issue\nPurchase\nMaterial Transfer\nManufacture" + }, + { + "doctype": "Key Set Detail", + "field_name": "taken_by", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Key Set Detail", + "field_name": "returned", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Key Set Detail", + "field_name": "key_set", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "property_owner", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "lease_customer", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "customer", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "property_user", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "security_status", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "property", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "wtax_paid_by", + "property": "in_standard_filter", + "property_type": "Check", + "value": "1" + }, + { + "doctype": "Lease", + "field_name": "security_status", + "property": "options", + "property_type": "Text", + "value": "\nProforma Invoice raised\nReceiving in process\nReceived\nReceived in part\nReturn in part\nReturned\nRecovered for rent\nRecovered for repairs\nNot required" + }, + { + "doctype": "Issue", + "property": "quick_entry", + "property_type": "Check", + "value": "0" + }, + { + "doctype": "Journal Entry Account", + "field_name": "cost_center", + "property": "columns", + "property_type": "Int", + "value": "1" + }, + { + "doctype": "Issue", + "field_name": "company", + "property": "fetch_from", + "property_type": "Small Text", + "value": "property_name.company" + } + + ] + for property in properties: + make_property_setter( + property.get("doctype"), + property.get("fieldname"), + property.get("property"), + property.get("value"), + property.get("property_type"), + for_doctype=False, + validate_fields_for_doctype=False + ) + +frappe.db.commit() \ No newline at end of file