[aii] some fixes
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 9532a54..cd33a07 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -362,13 +362,15 @@
})
// expense account
-cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
- return {
- "query": "accounts.utils.get_account_list",
- "filters": {
- "is_pl_account": "Yes",
- "debit_or_credit": "Debit",
- "company": doc.company
+if (sys_defaults.auto_inventory_accounting) {
+ cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "Yes",
+ "debit_or_credit": "Debit",
+ "company": doc.company
+ }
}
}
}
diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js
index 5e78b79..4682724 100644
--- a/setup/doctype/company/company.js
+++ b/setup/doctype/company/company.js
@@ -63,49 +63,50 @@
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
}
-
-cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
- return {
- "query": "accounts.utils.get_account_list",
- "filters": {
- "is_pl_account": "No",
- "debit_or_credit": "Debit",
- "company": doc.name
+if (sys_defaults.auto_inventory_accounting) {
+ cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Debit",
+ "company": doc.name
+ }
}
}
-}
-cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
- return {
- "query": "accounts.utils.get_account_list",
- "filters": {
- "is_pl_account": "Yes",
- "debit_or_credit": "Debit",
- "company": doc.name
+ cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "Yes",
+ "debit_or_credit": "Debit",
+ "company": doc.name
+ }
}
}
-}
-cur_frm.fields_dict["expenses_included_in_valuation"].get_query =
- cur_frm.fields_dict["stock_adjustment_account"].get_query;
+ cur_frm.fields_dict["expenses_included_in_valuation"].get_query =
+ cur_frm.fields_dict["stock_adjustment_account"].get_query;
-cur_frm.fields_dict["stock_delivered_but_not_billed"].get_query =
- cur_frm.fields_dict["stock_in_hand_account"].get_query;
+ cur_frm.fields_dict["stock_delivered_but_not_billed"].get_query =
+ cur_frm.fields_dict["stock_in_hand_account"].get_query;
-cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
- return {
- "query": "accounts.utils.get_account_list",
- "filters": {
- "is_pl_account": "No",
- "debit_or_credit": "Credit",
- "company": doc.name
+ cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Credit",
+ "company": doc.name
+ }
}
}
-}
-cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) {
- return {
- "query": "accounts.utils.get_cost_center_list",
- "filters": {"company": doc.name}
+ cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) {
+ return {
+ "query": "accounts.utils.get_cost_center_list",
+ "filters": {"company": doc.name}
+ }
}
}
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index 61df6b0..4589024 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -310,33 +310,36 @@
}
}
-cur_frm.cscript.expense_account = function(doc, cdt, cdn){
- var d = locals[cdt][cdn];
- if(d.expense_account) {
- var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
- for(var i = 0; i < cl.length; i++){
- if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
+if (sys_defaults.auto_inventory_accounting) {
+
+ cur_frm.cscript.expense_account = function(doc, cdt, cdn){
+ var d = locals[cdt][cdn];
+ if(d.expense_account) {
+ var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+ for(var i = 0; i < cl.length; i++){
+ if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
+ }
+ }
+ refresh_field(cur_frm.cscript.fname);
+ }
+
+ // expense account
+ cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "Yes",
+ "debit_or_credit": "Debit",
+ "company": doc.company
+ }
}
}
- refresh_field(cur_frm.cscript.fname);
-}
-// expense account
-cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) {
- return {
- "query": "accounts.utils.get_account_list",
- "filters": {
- "is_pl_account": "Yes",
- "debit_or_credit": "Debit",
- "company": doc.company
+ // cost center
+ cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
+ return {
+ query: "accounts.utils.get_cost_center_list",
+ filters: { company_name: doc.company}
}
}
-}
-
-// cost center
-cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
- return {
- query: "accounts.utils.get_cost_center_list",
- filters: { company_name: doc.company}
- }
}
\ No newline at end of file
diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js
index 3e21207..1f4aafa 100644
--- a/stock/doctype/stock_entry/stock_entry.js
+++ b/stock/doctype/stock_entry/stock_entry.js
@@ -77,7 +77,7 @@
};
if (sys_defaults.auto_inventory_accounting) {
- this.frm.add_fetch("company", "expense_adjustment_account", "stock_adjustment_account");
+ this.frm.add_fetch("company", "stock_adjustment_account", "expense_adjustment_account");
this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
return {
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.js b/stock/doctype/stock_reconciliation/stock_reconciliation.js
index 3938661..cf6821e 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -41,16 +41,17 @@
setup: function() {
var me = this;
+ if (sys_defaults.auto_inventory_accounting) {
+ this.frm.add_fetch("company", "stock_adjustment_account", "expense_account");
- this.frm.add_fetch("company", "expense_account", "stock_adjustment_account");
-
- this.frm.fields_dict["expense_account"].get_query = function() {
- return {
- "query": "accounts.utils.get_account_list",
- "filters": {
- "is_pl_account": "Yes",
- "debit_or_credit": "Debit",
- "company": me.frm.doc.company
+ this.frm.fields_dict["expense_account"].get_query = function() {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "Yes",
+ "debit_or_credit": "Debit",
+ "company": me.frm.doc.company
+ }
}
}
}