From 2186e836703e9fbcbbdb922fa55f30e6198f81ea Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 10 May 2013 00:39:15 +0530 Subject: [PATCH] [lead to customer] [fix] fix for creating customer from lead when there are restrictive permissions based on company for creating customer --- selling/doctype/lead/lead.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index d8d322d324..118b4c723e 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -104,7 +104,17 @@ cur_frm.cscript['Create Customer'] = function(){ 'from_to_list':"[['Lead', 'Customer']]" }, function(r,rt) { - loaddoc("Customer", n); + wn.model.with_doctype("Customer", function() { + var customer = wn.model.get_doc("Customer", n); + var customer_copy = $.extend({}, customer); + + var updated = wn.model.set_default_values(customer_copy); + $.each(updated, function(i, f) { + if(!customer[f]) customer[f] = customer_copy[f]; + }); + + loaddoc("Customer", n); + }); } ); }