[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

@@ -192,41 +192,40 @@ class DocType:
if self.check_gle_exists():
msgprint("""Account with existing transaction (Sales Invoice / Purchase Invoice / \
Journal Voucher) can not be trashed""", raise_exception=1)
Journal Voucher) can not be deleted""", raise_exception=1)
if self.check_if_child_exists():
msgprint("Child account exists for this account. You can not trash this account.",
msgprint("Child account exists for this account. You can not delete this account.",
raise_exception=1)
def on_trash(self):
self.validate_trash()
self.update_nsm_model()
def on_rename(self, new, old, merge=False):
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
parts = new.split(" - ")
if parts[-1].lower() != company_abbr.lower():
parts.append(company_abbr)
# rename account name
new_account_name = " - ".join(parts[:-1])
webnotes.conn.sql("update `tabAccount` set account_name = %s where name = %s", (new_account_name, old))
def before_rename(self, old, new, merge=False):
# Add company abbr if not provided
from setup.doctype.company.company import get_name_with_abbr
new_account = get_name_with_abbr(new, self.doc.company)
# Validate properties before merging
if merge:
new_name = " - ".join(parts)
val = list(webnotes.conn.get_value("Account", new_name,
val = list(webnotes.conn.get_value("Account", new_account,
["group_or_ledger", "debit_or_credit", "is_pl_account"]))
if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account]:
msgprint(_("""Merging is only possible if following \
webnotes.throw(_("""Merging is only possible if following \
properties are same in both records.
Group or Ledger, Debit or Credit, Is PL Account"""), raise_exception=1)
Group or Ledger, Debit or Credit, Is PL Account"""))
return new_account
def after_rename(self, old, new, merge=False):
if not merge:
webnotes.conn.set_value("Account", new, "account_name",
" - ".join(new.split(" - ")[:-1]))
else:
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree("Account", "parent_account")
return " - ".join(parts)
def get_master_name(doctype, txt, searchfield, start, page_len, filters):
conditions = (" and company='%s'"% filters["company"]) if doctype == "Warehouse" else ""

View File

@@ -16,7 +16,7 @@ class DocType(DocTypeNestedSet):
def autoname(self):
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
self.doc.company)[0][0]
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
def validate_mandatory(self):
if not self.doc.group_or_ledger:
@@ -73,18 +73,20 @@ class DocType(DocTypeNestedSet):
self.validate_mandatory()
self.validate_budget_details()
def on_rename(self, new, old, merge=False):
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
parts = new.split(" - ")
if parts[-1].lower() != company_abbr.lower():
parts.append(company_abbr)
# rename account name
cost_center_name = " - ".join(parts[:-1])
webnotes.conn.sql("update `tabCost Center` set cost_center_name = %s where name = %s", \
(cost_center_name, old))
def before_rename(self, olddn, newdn, merge=False):
# Add company abbr if not provided
from setup.doctype.company.company import get_name_with_abbr
new_cost_center = get_name_with_abbr(newdn, self.doc.company)
# Validate properties before merging
super(DocType, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger")
return new_cost_center
def after_rename(self, olddn, newdn, merge=False):
if not merge:
webnotes.conn.set_value("Cost Center", newdn, "cost_center_name",
" - ".join(newdn.split(" - ")[:-1]))
else:
super(DocType, self).after_rename(olddn, newdn, merge)
super(DocType, self).on_rename(new, old, merge, "group_or_ledger")
return " - ".join(parts)

View File

@@ -29,6 +29,11 @@ cur_frm.pformat.purchase_tax_details= function(doc){
var new_val = flt(val)/flt(doc.conversion_rate);
return new_val;
}
function print_hide(fieldname) {
var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name);
return doc_field.print_hide;
}
var cl = getchildren('Purchase Taxes and Charges',doc.name,'purchase_tax_details');
@@ -38,18 +43,21 @@ cur_frm.pformat.purchase_tax_details= function(doc){
// main table
out +='<table class="noborder" style="width:100%">'
+make_row('Net Total',convert_rate(doc.net_total),1);
if(!print_hide('net_total')) {
out += make_row('Net Total', convert_rate(doc.net_total), 1);
}
// add rows
if(cl.length){
for(var i=0;i<cl.length;i++){
out += make_row(cl[i].description,convert_rate(cl[i].tax_amount),0);
}
}
// grand total
out +=make_row('Grand Total',doc.grand_total_import,1)
if(doc.in_words_import){
// grand total
if(!print_hide('grand_total_import')) {
out += make_row('Grand Total', doc.grand_total_import, 1);
}
if(doc.in_words_import && !print_hide('in_words_import')){
out +='</table></td></tr>';
out += '<tr><td colspan = "2">';
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';

View File

@@ -73,10 +73,10 @@ def get_costcenter_target_details(filters):
def get_target_distribution_details(filters):
target_details = {}
for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation \
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,10 +113,11 @@ def get_costcenter_account_month_map(filters):
}))
tav_dict = cam_map[ccd.name][ccd.account][month]
month_percentage = ccd.distribution_id and \
tdd.get(ccd.distribution_id, {}).get(month, 0) or 100.0/12
month_percentage = tdd.get(ccd.distribution_id, {}).get(month, 0) \
if ccd.distribution_id else 100.0/12
tav_dict.target = flt(ccd.budget_allocated) * month_percentage /100
tav_dict.target = flt(ccd.budget_allocated) * month_percentage / 100
for ad in actual_details.get(ccd.name, {}).get(ccd.account, []):
if ad.month_name == month: