mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 18:54:55 +00:00
fix: #42014 --resolve conflicts
This commit is contained in:
committed by
GitHub
parent
5a2a404a50
commit
85d74050e1
@@ -28,42 +28,18 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
|
|||||||
erpnext.toggle_naming_series();
|
erpnext.toggle_naming_series();
|
||||||
|
|
||||||
if (!this.frm.is_new() && doc.__onload && !doc.__onload.is_customer) {
|
if (!this.frm.is_new() && doc.__onload && !doc.__onload.is_customer) {
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
this.frm.add_custom_button(__("Customer"), this.make_customer, __("Create"));
|
|
||||||
this.frm.add_custom_button(
|
|
||||||
__("Opportunity"),
|
|
||||||
function () {
|
|
||||||
me.frm.trigger("make_opportunity");
|
|
||||||
},
|
|
||||||
__("Create")
|
|
||||||
);
|
|
||||||
this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Create"));
|
|
||||||
=======
|
|
||||||
this.frm.add_custom_button(
|
|
||||||
__("Customer"),
|
|
||||||
this.make_customer.bind(this),
|
|
||||||
__("Create")
|
|
||||||
);
|
|
||||||
this.frm.add_custom_button(
|
|
||||||
__("Opportunity"),
|
|
||||||
this.make_opportunity.bind(this),
|
|
||||||
__("Create")
|
|
||||||
);
|
|
||||||
this.frm.add_custom_button(
|
|
||||||
__("Quotation"),
|
|
||||||
this.make_quotation.bind(this),
|
|
||||||
__("Create")
|
|
||||||
);
|
|
||||||
>>>>>>> 8304d19e8b (fix: creation of contact, customer, opportunity, quotation and prospect from lead)
|
|
||||||
=======
|
|
||||||
this.frm.add_custom_button(__("Customer"), this.make_customer.bind(this), __("Create"));
|
this.frm.add_custom_button(__("Customer"), this.make_customer.bind(this), __("Create"));
|
||||||
this.frm.add_custom_button(__("Opportunity"), this.make_opportunity.bind(this), __("Create"));
|
this.frm.add_custom_button(__("Opportunity"), this.make_opportunity.bind(this), __("Create"));
|
||||||
this.frm.add_custom_button(__("Quotation"), this.make_quotation.bind(this), __("Create"));
|
this.frm.add_custom_button(__("Quotation"), this.make_quotation.bind(this), __("Create"));
|
||||||
>>>>>>> 5844897c34 (fix: creation of contact, customer, opportunity, quotation and prospect from lead --prettier)
|
|
||||||
if (!doc.__onload.linked_prospects.length) {
|
if (!doc.__onload.linked_prospects.length) {
|
||||||
this.frm.add_custom_button(__("Prospect"), this.make_prospect.bind(this), __("Create"));
|
this.frm.add_custom_button(__("Prospect"), this.make_prospect.bind(this), __("Create"));
|
||||||
this.frm.add_custom_button(__("Add to Prospect"), this.add_lead_to_prospect, __("Action"));
|
this.frm.add_custom_button(
|
||||||
|
__("Add to Prospect"),
|
||||||
|
() => {
|
||||||
|
this.add_lead_to_prospect(this.frm);
|
||||||
|
},
|
||||||
|
__("Action")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,8 +53,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
|
|||||||
this.show_activities();
|
this.show_activities();
|
||||||
}
|
}
|
||||||
|
|
||||||
add_lead_to_prospect() {
|
add_lead_to_prospect(frm) {
|
||||||
let me = this;
|
|
||||||
frappe.prompt(
|
frappe.prompt(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -93,12 +68,12 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
|
|||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.crm.doctype.lead.lead.add_lead_to_prospect",
|
method: "erpnext.crm.doctype.lead.lead.add_lead_to_prospect",
|
||||||
args: {
|
args: {
|
||||||
lead: me.frm.doc.name,
|
lead: frm.doc.name,
|
||||||
prospect: data.prospect,
|
prospect: data.prospect,
|
||||||
},
|
},
|
||||||
callback: function (r) {
|
callback: function (r) {
|
||||||
if (!r.exc) {
|
if (!r.exc) {
|
||||||
me.frm.reload_doc();
|
frm.reload_doc();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
freeze: true,
|
freeze: true,
|
||||||
@@ -113,19 +88,17 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
|
|||||||
make_customer() {
|
make_customer() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.crm.doctype.lead.lead.make_customer",
|
method: "erpnext.crm.doctype.lead.lead.make_customer",
|
||||||
frm: cur_frm,
|
frm: this.frm,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
make_quotation() {
|
make_quotation() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.crm.doctype.lead.lead.make_quotation",
|
method: "erpnext.crm.doctype.lead.lead.make_quotation",
|
||||||
frm: cur_frm,
|
frm: this.frm,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
async make_opportunity() {
|
async make_opportunity() {
|
||||||
const frm = this.frm;
|
const frm = this.frm;
|
||||||
let existing_prospect = (
|
let existing_prospect = (
|
||||||
@@ -216,22 +189,22 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
>>>>>>> 8304d19e8b (fix: creation of contact, customer, opportunity, quotation and prospect from lead)
|
|
||||||
make_prospect() {
|
make_prospect() {
|
||||||
|
const me = this;
|
||||||
frappe.model.with_doctype("Prospect", function () {
|
frappe.model.with_doctype("Prospect", function () {
|
||||||
let prospect = frappe.model.get_new_doc("Prospect");
|
let prospect = frappe.model.get_new_doc("Prospect");
|
||||||
prospect.company_name = cur_frm.doc.company_name;
|
prospect.company_name = me.frm.doc.company_name;
|
||||||
prospect.no_of_employees = cur_frm.doc.no_of_employees;
|
prospect.no_of_employees = me.frm.doc.no_of_employees;
|
||||||
prospect.industry = cur_frm.doc.industry;
|
prospect.industry = me.frm.doc.industry;
|
||||||
prospect.market_segment = cur_frm.doc.market_segment;
|
prospect.market_segment = me.frm.doc.market_segment;
|
||||||
prospect.territory = cur_frm.doc.territory;
|
prospect.territory = me.frm.doc.territory;
|
||||||
prospect.fax = cur_frm.doc.fax;
|
prospect.fax = me.frm.doc.fax;
|
||||||
prospect.website = cur_frm.doc.website;
|
prospect.website = me.frm.doc.website;
|
||||||
prospect.prospect_owner = cur_frm.doc.lead_owner;
|
prospect.prospect_owner = me.frm.doc.lead_owner;
|
||||||
prospect.notes = cur_frm.doc.notes;
|
prospect.notes = me.frm.doc.notes;
|
||||||
|
|
||||||
let leads_row = frappe.model.add_child(prospect, "leads");
|
let leads_row = frappe.model.add_child(prospect, "leads");
|
||||||
leads_row.lead = cur_frm.doc.name;
|
leads_row.lead = me.frm.doc.name;
|
||||||
|
|
||||||
frappe.set_route("Form", "Prospect", prospect.name);
|
frappe.set_route("Form", "Prospect", prospect.name);
|
||||||
});
|
});
|
||||||
@@ -267,90 +240,3 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
|
|||||||
};
|
};
|
||||||
|
|
||||||
extend_cscript(cur_frm.cscript, new erpnext.LeadController({ frm: cur_frm }));
|
extend_cscript(cur_frm.cscript, new erpnext.LeadController({ frm: cur_frm }));
|
||||||
|
|
||||||
frappe.ui.form.on("Lead", {
|
|
||||||
make_opportunity: async function (frm) {
|
|
||||||
let existing_prospect = (
|
|
||||||
await frappe.db.get_value(
|
|
||||||
"Prospect Lead",
|
|
||||||
{
|
|
||||||
lead: frm.doc.name,
|
|
||||||
},
|
|
||||||
"name",
|
|
||||||
null,
|
|
||||||
"Prospect"
|
|
||||||
)
|
|
||||||
).message.name;
|
|
||||||
|
|
||||||
if (!existing_prospect) {
|
|
||||||
var fields = [
|
|
||||||
{
|
|
||||||
label: "Create Prospect",
|
|
||||||
fieldname: "create_prospect",
|
|
||||||
fieldtype: "Check",
|
|
||||||
default: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Prospect Name",
|
|
||||||
fieldname: "prospect_name",
|
|
||||||
fieldtype: "Data",
|
|
||||||
default: frm.doc.company_name,
|
|
||||||
depends_on: "create_prospect",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
let existing_contact = (
|
|
||||||
await frappe.db.get_value(
|
|
||||||
"Contact",
|
|
||||||
{
|
|
||||||
first_name: frm.doc.first_name || frm.doc.lead_name,
|
|
||||||
last_name: frm.doc.last_name,
|
|
||||||
},
|
|
||||||
"name"
|
|
||||||
)
|
|
||||||
).message.name;
|
|
||||||
|
|
||||||
if (!existing_contact) {
|
|
||||||
fields.push({
|
|
||||||
label: "Create Contact",
|
|
||||||
fieldname: "create_contact",
|
|
||||||
fieldtype: "Check",
|
|
||||||
default: "1",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fields) {
|
|
||||||
var d = new frappe.ui.Dialog({
|
|
||||||
title: __("Create Opportunity"),
|
|
||||||
fields: fields,
|
|
||||||
primary_action: function () {
|
|
||||||
var data = d.get_values();
|
|
||||||
frappe.call({
|
|
||||||
method: "create_prospect_and_contact",
|
|
||||||
doc: frm.doc,
|
|
||||||
args: {
|
|
||||||
data: data,
|
|
||||||
},
|
|
||||||
freeze: true,
|
|
||||||
callback: function (r) {
|
|
||||||
if (!r.exc) {
|
|
||||||
frappe.model.open_mapped_doc({
|
|
||||||
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
|
|
||||||
frm: frm,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
d.hide();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
primary_action_label: __("Create"),
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
} else {
|
|
||||||
frappe.model.open_mapped_doc({
|
|
||||||
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
|
|
||||||
frm: frm,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user