mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 15:39:20 +00:00
feat: provision to create customer from opportunity (#27145)
* feat: provision to create customer from opportunity (#27141)
* feat: provision to create customer from opportunity
* fead: linking of address and contact
* revert: create_opportunity_address_contact
* enabming print hide and no copy
(cherry picked from commit 4d98be2126)
# Conflicts:
# erpnext/crm/doctype/opportunity/opportunity.js
* Update opportunity.js
* fix: conflicts
Co-authored-by: Anupam Kumar <anupamvns0099@gmail.com>
Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
@@ -95,9 +95,17 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
}, __('Create'));
|
}, __('Create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.add_custom_button(__('Quotation'),
|
if (frm.doc.opportunity_from != "Customer") {
|
||||||
cur_frm.cscript.create_quotation, __('Create'));
|
frm.add_custom_button(__('Customer'),
|
||||||
|
function() {
|
||||||
|
frm.trigger("make_customer")
|
||||||
|
}, __('Create'));
|
||||||
|
}
|
||||||
|
|
||||||
|
frm.add_custom_button(__('Quotation'),
|
||||||
|
function() {
|
||||||
|
frm.trigger("create_quotation")
|
||||||
|
}, __('Create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus==0) {
|
if(!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus==0) {
|
||||||
@@ -194,6 +202,13 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
|
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
|
||||||
frm: cur_frm
|
frm: cur_frm
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
make_customer: function() {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.crm.doctype.opportunity.opportunity.make_customer",
|
||||||
|
frm: cur_frm
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -287,6 +287,24 @@ def make_request_for_quotation(source_name, target_doc=None):
|
|||||||
|
|
||||||
return doclist
|
return doclist
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def make_customer(source_name, target_doc=None):
|
||||||
|
def set_missing_values(source, target):
|
||||||
|
if source.opportunity_from == "Lead":
|
||||||
|
target.lead_name = source.party_name
|
||||||
|
|
||||||
|
doclist = get_mapped_doc("Opportunity", source_name, {
|
||||||
|
"Opportunity": {
|
||||||
|
"doctype": "Customer",
|
||||||
|
"field_map": {
|
||||||
|
"currency": "default_currency",
|
||||||
|
"customer_name": "customer_name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, target_doc, set_missing_values)
|
||||||
|
|
||||||
|
return doclist
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_supplier_quotation(source_name, target_doc=None):
|
def make_supplier_quotation(source_name, target_doc=None):
|
||||||
doclist = get_mapped_doc("Opportunity", source_name, {
|
doclist = get_mapped_doc("Opportunity", source_name, {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"tax_withholding_category",
|
"tax_withholding_category",
|
||||||
"default_bank_account",
|
"default_bank_account",
|
||||||
"lead_name",
|
"lead_name",
|
||||||
|
"opportunity_name",
|
||||||
"image",
|
"image",
|
||||||
"column_break0",
|
"column_break0",
|
||||||
"account_manager",
|
"account_manager",
|
||||||
@@ -493,6 +494,14 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Tax Withholding Category",
|
"label": "Tax Withholding Category",
|
||||||
"options": "Tax Withholding Category"
|
"options": "Tax Withholding Category"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "opportunity_name",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "From Opportunity",
|
||||||
|
"no_copy": 1,
|
||||||
|
"options": "Opportunity",
|
||||||
|
"print_hide": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-user",
|
"icon": "fa fa-user",
|
||||||
@@ -500,7 +509,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-01-28 12:54:57.258959",
|
"modified": "2021-08-25 18:56:09.929905",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Customer",
|
"name": "Customer",
|
||||||
|
|||||||
Reference in New Issue
Block a user