[Fix] Deferred account must be liability account (#14612)

This commit is contained in:
rohitwaghchaure 2018-06-21 11:55:49 +05:30 committed by Nabin Hait
parent 22bb61b58c
commit 4d80c05125
2 changed files with 11 additions and 0 deletions

View File

@ -548,6 +548,16 @@ frappe.ui.form.on('Sales Invoice', {
} }
} }
frm.fields_dict['items'].grid.get_field('deferred_revenue_account').get_query = function(doc) {
return {
filters: {
'root_type': 'Liability',
'company': doc.company,
"is_group": 0
}
}
}
frm.set_query('company_address', function(doc) { frm.set_query('company_address', function(doc) {
if(!doc.company) { if(!doc.company) {
frappe.throw(_('Please set Company')); frappe.throw(_('Please set Company'));

View File

@ -990,6 +990,7 @@ def booked_deferred_revenue():
# check for the sales invoice for which GL entries has to be done # check for the sales invoice for which GL entries has to be done
invoices = frappe.db.sql_list(''' invoices = frappe.db.sql_list('''
select parent from `tabSales Invoice Item` where service_start_date<=%s and service_end_date>=%s select parent from `tabSales Invoice Item` where service_start_date<=%s and service_end_date>=%s
and enable_deferred_revenue = 1 and docstatus = 1
''', (today(), add_months(today(), -1))) ''', (today(), add_months(today(), -1)))
# ToDo also find the list on the basic of the GL entry, and make another list # ToDo also find the list on the basic of the GL entry, and make another list