[minor] merge conflict fixed

This commit is contained in:
Nabin Hait
2013-11-21 12:28:50 +05:30
25 changed files with 225 additions and 226 deletions

View File

@@ -4,7 +4,6 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr
from webnotes.model.doc import Document, make_autoname
from webnotes import msgprint, _
import webnotes.defaults
@@ -144,20 +143,21 @@ class DocType(TransactionBase):
if self.doc.lead_name:
webnotes.conn.sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
def on_rename(self, new, old, merge=False):
def after_rename(self, old, new, merge=False):
#update customer_name if not naming series
if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
webnotes.conn.sql("""update `tabCustomer` set customer_name = %s where name = %s""",
(new, old))
webnotes.conn.set(self.doc, "customer_name", new)
for account in webnotes.conn.sql("""select name, account_name from
tabAccount where master_name=%s and master_type='Customer'""", old, as_dict=1):
if account.account_name != new:
webnotes.rename_doc("Account", account.name, new, merge=merge)
merge_account = True if merge and webnotes.conn.get_value("Account",
{"master_name": new, "master_type": "Customer"}) else False
webnotes.rename_doc("Account", account.name, new, merge=merge_account)
#update master_name in doctype account
#update master_name in account record
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
master_type = 'Customer' where master_name = %s""", (new,old))
master_type = 'Customer' where master_name = %s""", (new, old))
@webnotes.whitelist()
def get_dashboard_info(customer):

View File

@@ -76,7 +76,7 @@ def get_target_distribution_details(filters):
for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation
from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd
where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
target_details.setdefault(d.name, {}).setdefault(d.month, d.percentage_allocation)
target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
return target_details
@@ -115,8 +115,8 @@ def get_salesperson_item_month_map(filters):
}))
tav_dict = sim_map[sd.name][sd.item_group][month]
month_percentage = sd.distribution_id and \
tdd.get(sd.distribution_id, {}).get(month, 0) or 100.0/12
month_percentage = tdd.get(sd.distribution_id, {}).get(month, 0) \
if sd.distribution_id else 100.0/12
for ad in achieved_details.get(sd.name, {}).get(sd.item_group, []):
if (filters["target_on"] == "Quantity"):

View File

@@ -73,7 +73,7 @@ def get_target_distribution_details(filters):
for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation
from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd
where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
target_details.setdefault(d.name, {}).setdefault(d.month, d.percentage_allocation)
target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
return target_details
@@ -113,8 +113,8 @@ def get_territory_item_month_map(filters):
}))
tav_dict = tim_map[td.name][td.item_group][month]
month_percentage = td.distribution_id and \
tdd.get(td.distribution_id, {}).get(month, 0) or 100.0/12
month_percentage = tdd.get(td.distribution_id, {}).get(month, 0) \
if td.distribution_id else 100.0/12
for ad in achieved_details.get(td.name, {}).get(td.item_group, []):
if (filters["target_on"] == "Quantity"):