diff --git a/ram_custom/api/customer_quick_entry.py b/ram_custom/api/customer_quick_entry.py new file mode 100644 index 0000000..8f27c2b --- /dev/null +++ b/ram_custom/api/customer_quick_entry.py @@ -0,0 +1,28 @@ +import frappe + + +def set_extra_address_fields(doc, method=None): + """The Customer quick entry dialog collects Building Number and District + alongside the standard address fields, but core `make_address()` only + persists the fixed set it knows about. Copy the extra values onto the + primary address it just created.""" + building_number = doc.get("custom_building_number") + district = doc.get("custom_area") + if not (building_number or district): + return + + address_name = frappe.db.get_value( + "Dynamic Link", + {"link_doctype": "Customer", "link_name": doc.name, "parenttype": "Address"}, + "parent", + ) + if not address_name: + return + + values = {} + if building_number: + values["custom_building_number"] = building_number + if district: + values["custom_area"] = district + + frappe.db.set_value("Address", address_name, values) diff --git a/ram_custom/fixtures/custom_field.json b/ram_custom/fixtures/custom_field.json index 23d2931..3ef4546 100644 --- a/ram_custom/fixtures/custom_field.json +++ b/ram_custom/fixtures/custom_field.json @@ -1,115 +1,458 @@ [ - { - "name": "Sales Invoice Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Sales Invoice Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "warehouse", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - }, - { - "name": "Delivery Note Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Delivery Note Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "warehouse", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - }, - { - "name": "Quotation Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Quotation Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "warehouse", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - }, - { - "name": "Sales Order Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Sales Order Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "warehouse", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - }, - { - "name": "Purchase Receipt Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Purchase Receipt Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "warehouse", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - }, - { - "name": "Purchase Order Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Purchase Order Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "warehouse", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - }, - { - "name": "Purchase Invoice Item-cost_rate", - "doctype": "Custom Field", - "module": "Ram Custom", - "dt": "Purchase Invoice Item", - "label": "Cost Rate", - "fieldname": "cost_rate", - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "insert_after": "net_amount", - "hidden": 0, - "read_only": 1, - "permlevel": 0, - "reqd": 0, - "in_list_view": 1 - } -] - + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval:doc.customer_type=='Company'", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Customer", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_vat_registration_number", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "custom_customer_name_arabic", + "is_system_generated": 0, + "is_virtual": 0, + "label": "VAT Registration Number", + "length": 0, + "link_filters": null, + "mandatory_depends_on": "eval:doc.customer_type=='Company'", + "modified": "2026-09-15 09:10:25.769251", + "module": "Ram Custom", + "name": "Customer-custom_vat_registration_number", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "placeholder": null, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Invoice Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "net_amount", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:56.361383", + "module": "Ram Custom", + "name": "Purchase Invoice Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Order Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warehouse", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:56.180810", + "module": "Ram Custom", + "name": "Purchase Order Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Delivery Note Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warehouse", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:55.096160", + "module": "Ram Custom", + "name": "Delivery Note Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Quotation Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warehouse", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:55.300174", + "module": "Ram Custom", + "name": "Quotation Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Sales Order Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warehouse", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:55.544343", + "module": "Ram Custom", + "name": "Sales Order Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Receipt Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warehouse", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:55.936330", + "module": "Ram Custom", + "name": "Purchase Receipt Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "cost_rate", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warehouse", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Cost Rate", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2026-09-09 15:24:54.847262", + "module": "Ram Custom", + "name": "Sales Invoice Item-cost_rate", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "placeholder": null, + "precision": null, + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + } +] \ No newline at end of file diff --git a/ram_custom/fixtures/property_setter.json b/ram_custom/fixtures/property_setter.json new file mode 100644 index 0000000..3c6ddd4 --- /dev/null +++ b/ram_custom/fixtures/property_setter.json @@ -0,0 +1,258 @@ +[ + { + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "is_system_generated": 0, + "modified": "2026-09-10 08:47:09.572316", + "module": "Ram Custom", + "name": "Customer-main-field_order", + "property": "field_order", + "property_type": "Data", + "row_name": null, + "value": "[\"basic_info\", \"naming_series\", \"salutation\", \"customer_name\", \"custom_translate\", \"custom_customer_name_arabic\", \"custom_vat_registration_number\", \"custom_id_number_phone_no\", \"customer_type\", \"customer_group\", \"column_break0\", \"territory\", \"gender\", \"lead_name\", \"opportunity_name\", \"prospect_name\", \"account_manager\", \"image\", \"defaults_tab\", \"default_currency\", \"default_bank_account\", \"column_break_14\", \"default_price_list\", \"internal_customer_section\", \"is_internal_customer\", \"represents_company\", \"column_break_70\", \"companies\", \"custom_section_break_nxdgf\", \"custom_additional_ids\", \"more_info\", \"market_segment\", \"industry\", \"customer_pos_id\", \"website\", \"language\", \"column_break_45\", \"customer_details\", \"dashboard_tab\", \"contact_and_address_tab\", \"address_contacts\", \"address_html\", \"column_break1\", \"contact_html\", \"primary_address_and_contact_detail\", \"column_break_26\", \"customer_primary_address\", \"primary_address\", \"column_break_nwor\", \"customer_primary_contact\", \"mobile_no\", \"email_id\", \"first_name\", \"last_name\", \"tax_tab\", \"taxation_section\", \"tax_id\", \"column_break_21\", \"tax_category\", \"tax_withholding_category\", \"accounting_tab\", \"credit_limit_section\", \"payment_terms\", \"credit_limits\", \"default_receivable_accounts\", \"accounts\", \"loyalty_points_tab\", \"loyalty_program\", \"column_break_54\", \"loyalty_program_tier\", \"sales_team_tab\", \"sales_team\", \"sales_team_section\", \"default_sales_partner\", \"column_break_66\", \"default_commission_rate\", \"settings_tab\", \"so_required\", \"dn_required\", \"column_break_53\", \"is_frozen\", \"disabled\", \"portal_users_tab\", \"portal_users\"]" + }, + { + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "column_break_nwor", + "is_system_generated": 1, + "modified": "2026-09-09 21:16:31.112456", + "module": "Ram Custom", + "name": "Customer-column_break_nwor-fieldtype", + "property": "fieldtype", + "property_type": "Select", + "row_name": null, + "value": "Section Break" + }, + { + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "column_break_nwor", + "is_system_generated": 1, + "modified": "2026-09-09 21:16:31.434625", + "module": "Ram Custom", + "name": "Customer-column_break_nwor-label", + "property": "label", + "property_type": "Data", + "row_name": null, + "value": "Primary Contact Details" + }, + { + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "column_break_nwor", + "is_system_generated": 1, + "modified": "2026-09-09 21:16:31.720364", + "module": "Ram Custom", + "name": "Customer-column_break_nwor-collapsible", + "property": "collapsible", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "address_line2", + "is_system_generated": 1, + "modified": "2026-09-15 09:00:57.067520", + "module": "Ram Custom", + "name": "Address-address_line2-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "email_id", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:48.794256", + "module": "Ram Custom", + "name": "Address-email_id-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "phone", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.229767", + "module": "Ram Custom", + "name": "Address-phone-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "fax", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.277054", + "module": "Ram Custom", + "name": "Address-fax-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "tax_category", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.318245", + "module": "Ram Custom", + "name": "Address-tax_category-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "state", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.357719", + "module": "Ram Custom", + "name": "Address-state-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "county", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.399213", + "module": "Ram Custom", + "name": "Address-county-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "is_primary_address", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.436984", + "module": "Ram Custom", + "name": "Address-is_primary_address-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "is_shipping_address", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.477094", + "module": "Ram Custom", + "name": "Address-is_shipping_address-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "disabled", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.518721", + "module": "Ram Custom", + "name": "Address-disabled-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "linked_with", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.556751", + "module": "Ram Custom", + "name": "Address-linked_with-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Address", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "links", + "is_system_generated": 1, + "modified": "2026-09-15 09:04:49.596775", + "module": "Ram Custom", + "name": "Address-links-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + } +] \ No newline at end of file diff --git a/ram_custom/hooks.py b/ram_custom/hooks.py index fc30343..b6f9c0e 100644 --- a/ram_custom/hooks.py +++ b/ram_custom/hooks.py @@ -27,7 +27,7 @@ # include js, css files in header of desk.html # app_include_css = "/assets/ram_custom/css/ram_custom.css" # Cost rate: load on all Desk pages so it always runs (same effect as Client Script wiring). -app_include_js = ["/assets/ram_custom/js/cost_rate.js"] +app_include_js = ["/assets/ram_custom/js/cost_rate.js", "/assets/ram_custom/js/customer_quick_entry.js"] # include js, css files in header of web template # web_include_css = "/assets/ram_custom/css/ram_custom.css" @@ -55,6 +55,10 @@ "dt": "Custom Field", "filters": [["module", "=", "Ram Custom"]], }, + { + "dt": "Property Setter", + "filters": [["module", "=", "Ram Custom"]], + }, ] # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} @@ -163,6 +167,9 @@ "Purchase Invoice": { "validate": "ram_custom.api.inter_company_transfer.block_inter_company_invoices", }, + "Customer": { + "after_insert": "ram_custom.api.customer_quick_entry.set_extra_address_fields", + }, } # Scheduled Tasks diff --git a/ram_custom/public/js/customer_quick_entry.js b/ram_custom/public/js/customer_quick_entry.js new file mode 100644 index 0000000..d600040 --- /dev/null +++ b/ram_custom/public/js/customer_quick_entry.js @@ -0,0 +1,102 @@ +// Customer/Supplier quick entry: +// - "Primary Contact Details" stays its own collapsible section (Name, Mobile - optional). +// - "Primary Address Details" stays always expanded, reordered to match the +// agreed sketch: Short Address/Building No, Street/District, City/Postal Code, Country. +frappe.provide("frappe.ui.form"); + +$(document).ready(function () { + if (!frappe.ui.form.ContactAddressQuickEntryForm) return; + + frappe.ui.form.ContactAddressQuickEntryForm.prototype.get_variant_fields = function () { + return [ + { + fieldtype: "Section Break", + label: __("Primary Contact Details"), + collapsible: 1, + }, + { + label: __("Name"), + fieldname: "map_to_first_name", + fieldtype: "Data", + depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("Last Name"), + fieldname: "map_to_last_name", + fieldtype: "Data", + depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + fieldtype: "Column Break", + }, + { + label: __("Email Id"), + fieldname: "email_address", + fieldtype: "Data", + options: "Email", + }, + { + label: __("Mobile Number"), + fieldname: "mobile_number", + fieldtype: "Data", + }, + { + fieldtype: "Section Break", + label: __("Primary Address Details"), + collapsible: 0, + }, + { + label: __("Short Address"), + fieldname: "address_line1", + fieldtype: "Data", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("Street"), + fieldname: "address_line2", + fieldtype: "Data", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("City"), + fieldname: "city", + fieldtype: "Data", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("Country"), + fieldname: "country", + fieldtype: "Link", + options: "Country", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + fieldtype: "Column Break", + }, + { + label: __("Building Number"), + fieldname: "custom_building_number", + fieldtype: "Data", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("District"), + fieldname: "custom_area", + fieldtype: "Data", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("Postal Code"), + fieldname: "pincode", + fieldtype: "Data", + mandatory_depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'", + }, + { + label: __("Customer POS Id"), + fieldname: "customer_pos_id", + fieldtype: "Data", + hidden: 1, + }, + ]; + }; +});