Skip to content
Merged
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
10 changes: 3 additions & 7 deletions rmax_custom/public/js/create_customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,26 +151,22 @@ function open_create_customer_dialog(frm) {
frappe.msgprint("Pincode must be exactly 5 digits.");
return;
}
if (vat && ["Company", "Branch"].includes(type)) {

if (vat && type !== "Branch") {
frappe.db.get_value("Customer", {
custom_vat_registration_number: vat
}, "name").then(r => {

if (r.message && r.message.name) {
frappe.msgprint(
`VAT already exists for Customer: ${r.message.name}`
);
return;
}

create_customer();
});

} else {
create_customer();
return;
}

create_customer();
function create_customer() {
frappe.call({
method: "rmax_custom.api.customer.create_customer_with_address",
Expand Down
Loading