[aii] some fixes
This commit is contained in:
parent
30bd65a81b
commit
a477d41843
@ -362,13 +362,15 @@ 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) {
|
||||||
return {
|
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
|
||||||
"query": "accounts.utils.get_account_list",
|
return {
|
||||||
"filters": {
|
"query": "accounts.utils.get_account_list",
|
||||||
"is_pl_account": "Yes",
|
"filters": {
|
||||||
"debit_or_credit": "Debit",
|
"is_pl_account": "Yes",
|
||||||
"company": doc.company
|
"debit_or_credit": "Debit",
|
||||||
|
"company": doc.company
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,49 +63,50 @@ 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) {
|
||||||
|
return {
|
||||||
|
"query": "accounts.utils.get_account_list",
|
||||||
|
"filters": {
|
||||||
|
"is_pl_account": "No",
|
||||||
|
"debit_or_credit": "Debit",
|
||||||
|
"company": doc.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict["stock_in_hand_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": {
|
||||||
"is_pl_account": "No",
|
"is_pl_account": "Yes",
|
||||||
"debit_or_credit": "Debit",
|
"debit_or_credit": "Debit",
|
||||||
"company": doc.name
|
"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["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_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_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["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_adjustment_cost_center"].get_query = function(doc) {
|
|
||||||
return {
|
|
||||||
"query": "accounts.utils.get_cost_center_list",
|
|
||||||
"filters": {"company": doc.name}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -310,33 +310,36 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
if (sys_defaults.auto_inventory_accounting) {
|
||||||
var d = locals[cdt][cdn];
|
|
||||||
if(d.expense_account) {
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
||||||
var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
var d = locals[cdt][cdn];
|
||||||
for(var i = 0; i < cl.length; i++){
|
if(d.expense_account) {
|
||||||
if(!cl[i].expense_account) cl[i].expense_account = 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
|
// cost center
|
||||||
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("cost_center").get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
"query": "accounts.utils.get_account_list",
|
query: "accounts.utils.get_cost_center_list",
|
||||||
"filters": {
|
filters: { company_name: doc.company}
|
||||||
"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}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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 {
|
||||||
|
|||||||
@ -41,16 +41,17 @@ 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", "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 {
|
||||||
this.frm.fields_dict["expense_account"].get_query = function() {
|
"query": "accounts.utils.get_account_list",
|
||||||
return {
|
"filters": {
|
||||||
"query": "accounts.utils.get_account_list",
|
"is_pl_account": "Yes",
|
||||||
"filters": {
|
"debit_or_credit": "Debit",
|
||||||
"is_pl_account": "Yes",
|
"company": me.frm.doc.company
|
||||||
"debit_or_credit": "Debit",
|
}
|
||||||
"company": me.frm.doc.company
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user