Fix in accounts receivable report
This commit is contained in:
parent
18eb8c5f68
commit
a7af1d619e
@ -113,9 +113,8 @@ class AccountsReceivableReport(object):
|
|||||||
if not hasattr(self, "account_map"):
|
if not hasattr(self, "account_map"):
|
||||||
self.account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select
|
self.account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select
|
||||||
acc.name, cust.name as customer, cust.customer_name, cust.territory
|
acc.name, cust.name as customer, cust.customer_name, cust.territory
|
||||||
from `tabAccount` acc, `tabCustomer` cust
|
from `tabAccount` acc left join `tabCustomer` cust
|
||||||
where acc.master_type="Customer"
|
on cust.name=acc.master_name where acc.master_type="Customer" """, as_dict=True)))
|
||||||
and cust.name=acc.master_name""", as_dict=True)))
|
|
||||||
|
|
||||||
return self.account_map
|
return self.account_map
|
||||||
|
|
||||||
@ -134,7 +133,6 @@ class AccountsReceivableReport(object):
|
|||||||
self.gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
|
self.gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
|
||||||
where docstatus < 2 {0} order by posting_date, account""".format(conditions),
|
where docstatus < 2 {0} order by posting_date, account""".format(conditions),
|
||||||
values, as_dict=True)
|
values, as_dict=True)
|
||||||
|
|
||||||
return self.gl_entries
|
return self.gl_entries
|
||||||
|
|
||||||
def prepare_conditions(self):
|
def prepare_conditions(self):
|
||||||
|
@ -356,20 +356,23 @@ def get_actual_expense(args):
|
|||||||
and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s
|
and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s
|
||||||
""" % (args))[0][0]
|
""" % (args))[0][0]
|
||||||
|
|
||||||
def rename_account_for(dt, olddn, newdn, merge):
|
def rename_account_for(dt, olddn, newdn, merge, company):
|
||||||
old_account = get_account_for(dt, olddn)
|
old_account = get_account_for(dt, olddn)
|
||||||
if old_account:
|
if old_account:
|
||||||
new_account = None
|
new_account = None
|
||||||
if not merge:
|
if not merge:
|
||||||
if old_account == olddn:
|
if old_account == add_abbr_if_missing(olddn, company):
|
||||||
new_account = webnotes.rename_doc("Account", olddn, newdn)
|
new_account = webnotes.rename_doc("Account", old_account, newdn)
|
||||||
else:
|
else:
|
||||||
existing_new_account = get_account_for(dt, newdn)
|
existing_new_account = get_account_for(dt, newdn)
|
||||||
new_account = webnotes.rename_doc("Account", old_account,
|
new_account = webnotes.rename_doc("Account", old_account,
|
||||||
existing_new_account or newdn, merge=True if existing_new_account else False)
|
existing_new_account or newdn, merge=True if existing_new_account else False)
|
||||||
|
|
||||||
if new_account:
|
webnotes.conn.set_value("Account", new_account or old_account, "master_name", newdn)
|
||||||
webnotes.conn.set_value("Account", new_account, "master_name", newdn)
|
|
||||||
|
def add_abbr_if_missing(dn, company):
|
||||||
|
from setup.doctype.company.company import get_name_with_abbr
|
||||||
|
return get_name_with_abbr(dn, company)
|
||||||
|
|
||||||
def get_account_for(account_for_doctype, account_for):
|
def get_account_for(account_for_doctype, account_for):
|
||||||
if account_for_doctype in ["Customer", "Supplier"]:
|
if account_for_doctype in ["Customer", "Supplier"]:
|
||||||
|
@ -161,7 +161,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
def before_rename(self, olddn, newdn, merge=False):
|
def before_rename(self, olddn, newdn, merge=False):
|
||||||
from accounts.utils import rename_account_for
|
from accounts.utils import rename_account_for
|
||||||
rename_account_for("Supplier", olddn, newdn, merge)
|
rename_account_for("Supplier", olddn, newdn, merge, self.doc.company)
|
||||||
|
|
||||||
def after_rename(self, olddn, newdn, merge=False):
|
def after_rename(self, olddn, newdn, merge=False):
|
||||||
set_field = ''
|
set_field = ''
|
||||||
|
@ -156,7 +156,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
def before_rename(self, olddn, newdn, merge=False):
|
def before_rename(self, olddn, newdn, merge=False):
|
||||||
from accounts.utils import rename_account_for
|
from accounts.utils import rename_account_for
|
||||||
rename_account_for("Customer", olddn, newdn, merge)
|
rename_account_for("Customer", olddn, newdn, merge, self.doc.company)
|
||||||
|
|
||||||
def after_rename(self, olddn, newdn, merge=False):
|
def after_rename(self, olddn, newdn, merge=False):
|
||||||
set_field = ''
|
set_field = ''
|
||||||
|
@ -102,7 +102,7 @@ class DocType:
|
|||||||
webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
|
webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
|
||||||
|
|
||||||
from accounts.utils import rename_account_for
|
from accounts.utils import rename_account_for
|
||||||
rename_account_for("Warehouse", olddn, newdn, merge)
|
rename_account_for("Warehouse", olddn, newdn, merge, self.doc.company)
|
||||||
|
|
||||||
return newdn
|
return newdn
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user