Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions rmax_custom/api/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ def create_customer_with_address(
country=None,
default_currency=None,
tax_id=None,
custom_vat_registration_number=None,
commercial_registration_number=None,
address_type=None,
address_line1=None,
address_line2=None,
building_number=None,
custom_building_number=None,
city=None,
state=None,
pincode=None,
district=None
custom_area=None,


):

if not customer_name:
Expand Down Expand Up @@ -68,7 +71,8 @@ def create_customer_with_address(
"default_currency": default_currency,
"tax_id": tax_id,
"mobile_no": mobile_no,
"email_id": email_id
"email_id": email_id,
"custom_vat_registration_number": custom_vat_registration_number,
})

customer.insert(ignore_permissions=True)
Expand All @@ -83,6 +87,8 @@ def create_customer_with_address(
"address_line2": address_line2,
"city": city,
"state": state,
"custom_area": custom_area,
"custom_building_number": custom_building_number,
"pincode": pincode,
"country": country,
"is_primary_address": 1,
Expand Down
33 changes: 31 additions & 2 deletions rmax_custom/public/js/create_customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function open_create_customer_dialog(frm) {

let d = new frappe.ui.Dialog({
title: "Create New Customer",
size: "large", // important when many fields

fields: [
{
fieldname: "customer_name",
Expand All @@ -62,6 +64,11 @@ function open_create_customer_dialog(frm) {
fieldtype: "Data",
label: "Email ID"
},
{
fieldname: "custom_vat_registration_number",
fieldtype: "Data",
label: "VAT Registration Number"
},
{ fieldtype: "Section Break", label: "Address Details" },
{
fieldname: "address_type",
Expand All @@ -82,6 +89,18 @@ function open_create_customer_dialog(frm) {
fieldtype: "Data",
label: "Address Line 2"
},
{
fieldname: "custom_building_number",
fieldtype: "Data",
label: "Building Number",
reqd: 1
},
{
fieldname: "custom_area",
fieldtype: "Data",
label: "Area/District",
reqd: 1
},
{
fieldname: "city",
fieldtype: "Data",
Expand All @@ -96,7 +115,12 @@ function open_create_customer_dialog(frm) {
default: country,
reqd: 1
},

{
fieldname: "pincode",
fieldtype: "Data",
label: "Postal Code",
reqd: 1
},

],
primary_action_label: "Create Customer",
Expand All @@ -111,6 +135,10 @@ function open_create_customer_dialog(frm) {
address_type: values.address_type,
address_line1: values.address_line1,
address_line2: values.address_line2 || null,
custom_vat_registration_number: values.custom_vat_registration_number || null,
custom_building_number: values.custom_building_number,
custom_area: values.custom_area,
pincode: values.pincode,
city: values.city,
country: values.country,
default_currency: default_currency
Expand All @@ -135,4 +163,5 @@ function open_create_customer_dialog(frm) {

d.show();
});
}
}

Loading