[minor] merge conflict

This commit is contained in:
Nabin Hait
2013-12-14 17:36:22 +05:30
23 changed files with 213 additions and 138 deletions

View File

@@ -47,6 +47,14 @@ class DocType(TransactionBase):
if self.doc.lead_name:
webnotes.conn.sql("update `tabLead` set status='Converted' where name = %s", self.doc.lead_name)
def update_address(self):
webnotes.conn.sql("""update `tabAddress` set customer_name=%s, modified=NOW()
where customer=%s""", (self.doc.customer_name, self.doc.name))
def update_contact(self):
webnotes.conn.sql("""update `tabContact` set customer_name=%s, modified=NOW()
where customer=%s""", (self.doc.customer_name, self.doc.name))
def create_account_head(self):
if self.doc.company :
abbr = self.get_company_abbr()
@@ -99,6 +107,9 @@ class DocType(TransactionBase):
self.validate_name_with_customer_group()
self.update_lead_status()
self.update_address()
self.update_contact()
# create account head
self.create_account_head()
# update credit days and limit in account
@@ -146,10 +157,19 @@ class DocType(TransactionBase):
def before_rename(self, olddn, newdn, merge=False):
from accounts.utils import rename_account_for
rename_account_for("Customer", olddn, newdn, merge)
def after_rename(self, olddn, newdn, merge=False):
set_field = ''
if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
webnotes.conn.set(self.doc, "customer_name", newdn)
self.update_contact()
set_field = ", customer_name=%(newdn)s"
self.update_customer_address(newdn, set_field)
def update_customer_address(self, newdn, set_field):
webnotes.conn.sql("""update `tabAddress` set address_title=%(newdn)s
{set_field} where customer=%(newdn)s"""\
.format(set_field=set_field), ({"newdn": newdn}))
@webnotes.whitelist()
def get_dashboard_info(customer):

View File

@@ -95,7 +95,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
refresh: function() {
this._super();
this.frm.toggle_display("customer_name",
(this.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
(this.frm.doc.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
if(this.frm.fields_dict.packing_details) {
var packing_list_exists = this.frm.get_doclist({parentfield: "packing_details"}).length;
this.frm.toggle_display("packing_list", packing_list_exists ? true : false);