diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index f554cafb48..ad097c0542 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -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) { if(!doc.company) { frappe.throw(_('Please set Company')); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index d4c3c2637b..10ae574406 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -990,6 +990,7 @@ def booked_deferred_revenue(): # check for the sales invoice for which GL entries has to be done invoices = frappe.db.sql_list(''' 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))) # ToDo also find the list on the basic of the GL entry, and make another list