[fix] [minor] merge conflict fixed

This commit is contained in:
Akhilesh Darjee
2013-11-26 11:21:07 +05:30
50 changed files with 322 additions and 289 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

@@ -1,4 +1,4 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
@@ -19,12 +19,13 @@ class AccountsReceivableReport(object):
def get_columns(self):
return [
"Posting Date:Date:80", "Account:Link/Account:150", "Customer::150",
"Voucher Type::110", "Voucher No::120", "Remarks::150",
"Due Date:Date:80", "Territory:Link/Territory:80",
"Posting Date:Date:80", "Account:Link/Account:150",
"Voucher Type::110", "Voucher No::120", "::30",
"Due Date:Date:80",
"Invoiced Amount:Currency:100", "Payment Received:Currency:100",
"Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100",
"30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
"30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100",
"Customer:Link/Customer:200", "Territory:Link/Territory:80", "Remarks::200"
]
def get_data(self):
@@ -37,14 +38,20 @@ class AccountsReceivableReport(object):
due_date = self.get_due_date(gle)
invoiced_amount = gle.debit if (gle.debit > 0) else 0
payment_received = invoiced_amount - outstanding_amount
row = [gle.posting_date, gle.account, self.get_customer(gle.account),
gle.voucher_type, gle.voucher_no, gle.remarks, due_date,
self.get_territory(gle.account), invoiced_amount, payment_received,
row = [gle.posting_date, gle.account,
gle.voucher_type, gle.voucher_no, due_date,
invoiced_amount, payment_received,
outstanding_amount]
entry_date = due_date if self.filters.ageing_based_on=="Due Date" \
else gle.posting_date
row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount)
row += [self.get_customer(gle.account), self.get_territory(gle.account), gle.remarks]
data.append(row)
for i in range(0,len(data)):
data[i].insert(4, """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
% ("/".join(["#Form", data[i][2], data[i][3]]),))
return data
def get_entries_after(self, report_date):
@@ -157,4 +164,4 @@ def get_ageing_data(age_as_on, entry_date, outstanding_amount):
if index is None: index = 3
outstanding_range[index] = outstanding_amount
return [age] + outstanding_range
return [age] + outstanding_range

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: