mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-22 03:35:43 +00:00
fix: Invoice with no GLEs in deferred report
(cherry picked from commit 1c613ada6f)
This commit is contained in:
@@ -58,9 +58,9 @@ class Deferred_Item:
|
|||||||
For a given GL/Journal posting, get balance based on item type
|
For a given GL/Journal posting, get balance based on item type
|
||||||
"""
|
"""
|
||||||
if self.type == "Deferred Sale Item":
|
if self.type == "Deferred Sale Item":
|
||||||
return entry.debit - entry.credit
|
return flt(entry.debit) - flt(entry.credit)
|
||||||
elif self.type == "Deferred Purchase Item":
|
elif self.type == "Deferred Purchase Item":
|
||||||
return -(entry.credit - entry.debit)
|
return -(flt(entry.credit) - flt(entry.debit))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get_item_total(self):
|
def get_item_total(self):
|
||||||
@@ -147,7 +147,7 @@ class Deferred_Item:
|
|||||||
actual = 0
|
actual = 0
|
||||||
for posting in self.gle_entries:
|
for posting in self.gle_entries:
|
||||||
# if period.from_date <= posting.posting_date <= period.to_date:
|
# if period.from_date <= posting.posting_date <= period.to_date:
|
||||||
if period.from_date <= posting.gle_posting_date <= period.to_date:
|
if period.from_date <= getdate(posting.gle_posting_date) <= period.to_date:
|
||||||
period_sum += self.get_amount(posting)
|
period_sum += self.get_amount(posting)
|
||||||
if posting.posted == "posted":
|
if posting.posted == "posted":
|
||||||
actual += self.get_amount(posting)
|
actual += self.get_amount(posting)
|
||||||
@@ -285,7 +285,7 @@ class Deferred_Revenue_and_Expense_Report:
|
|||||||
qb.from_(inv_item)
|
qb.from_(inv_item)
|
||||||
.join(inv)
|
.join(inv)
|
||||||
.on(inv.name == inv_item.parent)
|
.on(inv.name == inv_item.parent)
|
||||||
.join(gle)
|
.left_join(gle)
|
||||||
.on((inv_item.name == gle.voucher_detail_no) & (deferred_account_field == gle.account))
|
.on((inv_item.name == gle.voucher_detail_no) & (deferred_account_field == gle.account))
|
||||||
.select(
|
.select(
|
||||||
inv.name.as_("doc"),
|
inv.name.as_("doc"),
|
||||||
@@ -318,7 +318,7 @@ class Deferred_Revenue_and_Expense_Report:
|
|||||||
.groupby(inv.name, inv_item.name, gle.posting_date)
|
.groupby(inv.name, inv_item.name, gle.posting_date)
|
||||||
.orderby(gle.posting_date)
|
.orderby(gle.posting_date)
|
||||||
)
|
)
|
||||||
self.invoices = query.run(as_dict=True)
|
self.invoices = query.run(as_dict=True, debug=1)
|
||||||
|
|
||||||
uniq_invoice = set([x.doc for x in self.invoices])
|
uniq_invoice = set([x.doc for x in self.invoices])
|
||||||
for inv in uniq_invoice:
|
for inv in uniq_invoice:
|
||||||
|
|||||||
Reference in New Issue
Block a user