Merge pull request #1264 from akhileshdarjee/hotfix
fixed accounts receivable for customer name
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index 6b94ba1..e5cea8c 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -120,7 +120,8 @@
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
- "company": doc.company
+ "company": doc.company,
+ group_by_voucher: 0
};
wn.set_route("query-report", "General Ledger");
}, "icon-table");
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index 0bdc70e..1055bdd 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -35,7 +35,8 @@
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
- "company": doc.company
+ "company": doc.company,
+ group_by_voucher: 0
};
wn.set_route("query-report", "General Ledger");
}, "icon-table");
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py
index 404627a..0b8ad46 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -350,7 +350,6 @@
# item gl entries
stock_item_and_auto_accounting_for_stock = False
stock_items = self.get_stock_items()
- # rounding_diff = 0.0
for item in self.doclist.get({"parentfield": "entries"}):
if auto_accounting_for_stock and item.item_code in stock_items:
if flt(item.valuation_rate):
@@ -361,11 +360,6 @@
valuation_amt = item.amount + item.item_tax_amount + item.rm_supp_cost
- # rounding_diff += (flt(item.amount, self.precision("amount", item)) +
- # flt(item.item_tax_amount, self.precision("item_tax_amount", item)) +
- # flt(item.rm_supp_cost, self.precision("rm_supp_cost", item)) -
- # valuation_amt)
-
gl_entries.append(
self.get_gl_dict({
"account": item.expense_head,
@@ -392,12 +386,6 @@
# this will balance out valuation amount included in cost of goods sold
expenses_included_in_valuation = \
self.get_company_default("expenses_included_in_valuation")
-
- # if rounding_diff:
- # import operator
- # cost_center_with_max_value = max(valuation_tax.iteritems(),
- # key=operator.itemgetter(1))[0]
- # valuation_tax[cost_center_with_max_value] -= flt(rounding_diff)
for cost_center, amount in valuation_tax.items():
gl_entries.append(
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index a390fb4..3bdef5b 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -54,7 +54,8 @@
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
- "company": doc.company
+ "company": doc.company,
+ group_by_voucher: 0
};
wn.set_route("query-report", "General Ledger");
}, "icon-table");
diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py
index 2efc824..855b7d1 100644
--- a/accounts/report/general_ledger/general_ledger.py
+++ b/accounts/report/general_ledger/general_ledger.py
@@ -136,7 +136,7 @@
or cstr(gle.is_advance) == "Yes"):
gle_map[gle.account].opening += amount
opening += amount
- elif gle.posting_date < filters.to_date:
+ elif gle.posting_date <= filters.to_date:
gle_map[gle.account].entries.append(gle)
gle_map[gle.account].total_debit += flt(gle.debit)
gle_map[gle.account].total_credit += flt(gle.credit)
diff --git a/accounts/utils.py b/accounts/utils.py
index 8971c80..a5fb390 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -31,6 +31,8 @@
if not fy:
error_msg = """%s %s not in any Fiscal Year""" % (label, formatdate(date))
+ error_msg = """{msg}: {date}""".format(msg=_("Fiscal Year does not exist for date"),
+ date=formatdate(date))
if verbose: webnotes.msgprint(error_msg)
raise FiscalYearError, error_msg
diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py
index 4aa08d6..3c6981d 100644
--- a/controllers/buying_controller.py
+++ b/controllers/buying_controller.py
@@ -174,9 +174,11 @@
"""
stock_items = self.get_stock_items()
- stock_items_amount = sum([flt(d.amount) for d in
- self.doclist.get({"parentfield": parentfield})
- if d.item_code and d.item_code in stock_items])
+ stock_items_qty, stock_items_amount = 0, 0
+ for d in self.doclist.get({"parentfield": parentfield}):
+ if d.item_code and d.item_code in stock_items:
+ stock_items_qty += flt(d.qty)
+ stock_items_amount += flt(d.amount)
total_valuation_amount = sum([flt(d.tax_amount) for d in
self.doclist.get({"parentfield": "purchase_tax_details"})
@@ -185,8 +187,11 @@
for item in self.doclist.get({"parentfield": parentfield}):
if item.item_code and item.qty and item.item_code in stock_items:
- item.item_tax_amount = flt(flt(item.amount) * total_valuation_amount \
- / stock_items_amount, self.precision("item_tax_amount", item))
+ item_proportion = flt(item.amount) / stock_items_amount if stock_items_amount \
+ else flt(item.qty) / stock_items_qty
+
+ item.item_tax_amount = flt(item_proportion * total_valuation_amount,
+ self.precision("item_tax_amount", item))
self.round_floats_in(item)
diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js
index d2fb904..6a4261c 100644
--- a/public/js/controllers/stock_controller.js
+++ b/public/js/controllers/stock_controller.js
@@ -28,7 +28,8 @@
voucher_no: me.frm.doc.name,
from_date: me.frm.doc.posting_date,
to_date: me.frm.doc.posting_date,
- company: me.frm.doc.company
+ company: me.frm.doc.company,
+ group_by_voucher: false
};
wn.set_route("query-report", "General Ledger");
}, "icon-table");