Merge pull request #35609 from GursheenK/#34282-Record-advance-payment-as-a-liability
feat: Record Advance Payment as a liability
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 68407e0..8753ebc 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -674,19 +674,6 @@
}
}
- // expense account
- frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) {
- if (erpnext.is_perpetual_inventory_enabled(doc.company)) {
- return {
- filters: {
- 'report_type': 'Profit and Loss',
- 'company': doc.company,
- "is_group": 0
- }
- }
- }
- }
-
// discount account
frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) {
return {
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
index 1c461ef..298d838 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
@@ -14,8 +14,10 @@
"label": __("Project"),
"fieldtype": "MultiSelectList",
get_data: function(txt) {
- return frappe.db.get_link_options('Project', txt);
- }
+ return frappe.db.get_link_options('Project', txt, {
+ company: frappe.query_report.get_filter_value("company")
+ });
+ },
},
{
"fieldname": "include_default_book_entries",
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index f007430..502ee57 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -289,7 +289,8 @@
"fieldtype": "Link",
"label": "Company",
"options": "Company",
- "remember_last_selected_value": 1
+ "remember_last_selected_value": 1,
+ "reqd": 1
},
{
"fieldname": "column_break_28",
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 0d92683..543d0e9 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -193,7 +193,9 @@
this.frm.set_query("expense_account", "items", function(doc) {
return {
filters: {
- "company": doc.company
+ "company": doc.company,
+ "report_type": "Profit and Loss",
+ "is_group": 0
}
};
});