mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 17:04:47 +00:00
minor fix in deferred revenue booking
This commit is contained in:
@@ -1119,12 +1119,12 @@ class SalesInvoice(SellingController):
|
|||||||
select name, posting_date from `tabGL Entry` where company=%s and account=%s and
|
select name, posting_date from `tabGL Entry` where company=%s and account=%s and
|
||||||
voucher_type=%s and voucher_no=%s and voucher_detail_no=%s
|
voucher_type=%s and voucher_no=%s and voucher_detail_no=%s
|
||||||
order by posting_date desc limit 1
|
order by posting_date desc limit 1
|
||||||
''', (self.company, item.deferred_revenue_account, "Sales Invoice", self.name, item.name), as_dict=True)[0]
|
''', (self.company, item.deferred_revenue_account, "Sales Invoice", self.name, item.name), as_dict=True)
|
||||||
|
|
||||||
if not prev_gl_entry:
|
if not prev_gl_entry:
|
||||||
booking_start_date = item.service_start_date
|
booking_start_date = item.service_start_date
|
||||||
else:
|
else:
|
||||||
booking_start_date = getdate(add_days(prev_gl_entry.posting_date, 1))
|
booking_start_date = getdate(add_days(prev_gl_entry[0].posting_date, 1))
|
||||||
|
|
||||||
total_days = date_diff(item.service_end_date, item.service_start_date)
|
total_days = date_diff(item.service_end_date, item.service_start_date)
|
||||||
total_booking_days = date_diff(booking_end_date, booking_start_date) + 1
|
total_booking_days = date_diff(booking_end_date, booking_start_date) + 1
|
||||||
@@ -1141,12 +1141,14 @@ class SalesInvoice(SellingController):
|
|||||||
select sum(debit) as total_debit, sum(debit_in_account_currency) as total_debit_in_account_currency, voucher_detail_no
|
select sum(debit) as total_debit, sum(debit_in_account_currency) as total_debit_in_account_currency, voucher_detail_no
|
||||||
from `tabGL Entry` where company=%s and account=%s and voucher_type=%s and voucher_no=%s and voucher_detail_no=%s
|
from `tabGL Entry` where company=%s and account=%s and voucher_type=%s and voucher_no=%s and voucher_detail_no=%s
|
||||||
group by voucher_detail_no
|
group by voucher_detail_no
|
||||||
''', (self.company, item.deferred_revenue_account, "Sales Invoice", self.name, item.name), as_dict=True)[0]
|
''', (self.company, item.deferred_revenue_account, "Sales Invoice", self.name, item.name), as_dict=True)
|
||||||
base_amount = flt(item.base_net_amount - gl_entries_details.total_debit, item.precision("base_net_amount"))
|
already_booked_amount = gl_entries_details[0].total_debit if gl_entries_details else 0
|
||||||
|
base_amount = flt(item.base_net_amount - already_booked_amount, item.precision("base_net_amount"))
|
||||||
if account_currency==self.company_currency:
|
if account_currency==self.company_currency:
|
||||||
amount = base_amount
|
amount = base_amount
|
||||||
else:
|
else:
|
||||||
amount = flt(item.net_amount - gl_entries_details.total_debit_in_account_currency, item.precision("net_amount"))
|
already_booked_amount_in_account_currency = gl_entries_details[0].total_debit_in_account_currency if gl_entries_details else 0
|
||||||
|
amount = flt(item.net_amount - already_booked_amount_in_account_currency, item.precision("net_amount"))
|
||||||
|
|
||||||
# GL Entry for crediting the amount in the income
|
# GL Entry for crediting the amount in the income
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
|
|||||||
Reference in New Issue
Block a user