[aii] some fixes

This commit is contained in:
Nabin Hait 2013-04-08 12:39:11 +05:30
parent 30bd65a81b
commit a477d41843
5 changed files with 81 additions and 74 deletions

View File

@ -362,7 +362,8 @@ cur_frm.set_query("income_account", "entries", function(doc) {
}) })
// expense account // expense account
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) { if (sys_defaults.auto_inventory_accounting) {
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
@ -371,6 +372,7 @@ cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = fun
"company": doc.company "company": doc.company
} }
} }
}
} }
// warehouse in detail table // warehouse in detail table

View File

@ -63,8 +63,8 @@ cur_frm.fields_dict.payables_group.get_query = function(doc) {
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'; 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';
} }
if (sys_defaults.auto_inventory_accounting) {
cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) { cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
@ -73,9 +73,9 @@ cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
"company": doc.name "company": doc.name
} }
} }
} }
cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) { cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
@ -84,15 +84,15 @@ cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
"company": doc.name "company": doc.name
} }
} }
} }
cur_frm.fields_dict["expenses_included_in_valuation"].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_adjustment_account"].get_query;
cur_frm.fields_dict["stock_delivered_but_not_billed"].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_in_hand_account"].get_query;
cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) { cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
@ -101,11 +101,12 @@ cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
"company": doc.name "company": doc.name
} }
} }
} }
cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) { cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) {
return { return {
"query": "accounts.utils.get_cost_center_list", "query": "accounts.utils.get_cost_center_list",
"filters": {"company": doc.name} "filters": {"company": doc.name}
} }
}
} }

View File

@ -310,7 +310,9 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
} }
} }
cur_frm.cscript.expense_account = function(doc, cdt, cdn){ if (sys_defaults.auto_inventory_accounting) {
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(d.expense_account) { if(d.expense_account) {
var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype); var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
@ -319,10 +321,10 @@ cur_frm.cscript.expense_account = function(doc, cdt, cdn){
} }
} }
refresh_field(cur_frm.cscript.fname); refresh_field(cur_frm.cscript.fname);
} }
// expense account // expense account
cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) { cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) {
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
@ -331,12 +333,13 @@ cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').g
"company": doc.company "company": doc.company
} }
} }
} }
// cost center // cost center
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) { cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
return { return {
query: "accounts.utils.get_cost_center_list", query: "accounts.utils.get_cost_center_list",
filters: { company_name: doc.company} filters: { company_name: doc.company}
} }
}
} }

View File

@ -77,7 +77,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
}; };
if (sys_defaults.auto_inventory_accounting) { 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() { this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
return { return {

View File

@ -41,8 +41,8 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
setup: function() { setup: function() {
var me = this; var me = this;
if (sys_defaults.auto_inventory_accounting) {
this.frm.add_fetch("company", "expense_account", "stock_adjustment_account"); this.frm.add_fetch("company", "stock_adjustment_account", "expense_account");
this.frm.fields_dict["expense_account"].get_query = function() { this.frm.fields_dict["expense_account"].get_query = function() {
return { return {
@ -54,6 +54,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
} }
} }
} }
}
}, },
refresh: function() { refresh: function() {