From 3110c4a772636f8dcbe7f15d071305eb991180f5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 Feb 2016 17:20:59 +0530 Subject: [PATCH 1/4] [fix] Make bank entry from expense claim --- erpnext/hr/doctype/expense_claim/expense_claim.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index 85cd38df41..c486391ee5 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -95,11 +95,11 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){ if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved") cur_frm.savesubmit(); - if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") && + if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") && doc.approval_status=="Approved" && cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount)) - cur_frm.add_custom_button(__("Bank Entry"), - cur_frm.cscript.make_bank_entry, __("Make")); - cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + cur_frm.add_custom_button(__("Bank Entry"), + cur_frm.cscript.make_bank_entry, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } } From a731ad4433175f64de70605394c58c1634fafdbf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 Feb 2016 17:21:28 +0530 Subject: [PATCH 2/4] [fix] Set party account on chnage of company --- erpnext/public/js/controllers/transaction.js | 34 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index b8d9f04915..58c68e8d7f 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -243,7 +243,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ company: function() { var me = this; - var fn = function() { + var set_pricing = function() { if(me.frm.doc.company && me.frm.fields_dict.currency) { var company_currency = me.get_company_currency(); var company_doc = frappe.get_doc(":Company", me.frm.doc.company); @@ -270,10 +270,40 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ me.apply_pricing_rule(); } } + + var set_party_account = function(set_pricing) { + if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) { + if(me.frm.doc.doctype=="Sales Invoice") { + var party_type = "Customer"; + var party_account_field = 'debit_to'; + } else { + var party_type = "Supplier"; + var party_account_field = 'credit_to'; + } + + return frappe.call({ + method: "erpnext.accounts.party.get_party_account", + args: { + company: me.frm.doc.company, + party_type: party_type, + party: me.frm.doc[frappe.model.scrub(party_type)] + }, + callback: function(r) { + if(!r.exc && r.message) { + me.frm.set_value(party_account_field, r.message); + set_pricing(); + } + } + }); + } else { + set_pricing(); + } + + } if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; else var date = this.frm.doc.transaction_date; - erpnext.get_fiscal_year(this.frm.doc.company, date, fn); + erpnext.get_fiscal_year(this.frm.doc.company, date, function() { set_party_account(set_pricing); }); if(this.frm.doc.company) { erpnext.last_selected_company = this.frm.doc.company; From 92c6c617dec036c3f91ec4ff125e8d0b8ed1f9c0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 Feb 2016 17:22:26 +0530 Subject: [PATCH 3/4] [fix] Remove filters on item group in territory and sales person target settings --- erpnext/setup/doctype/sales_person/sales_person.js | 6 ------ erpnext/setup/doctype/territory/territory.js | 10 +--------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js index 6d02d0d829..8bae546a1c 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.js +++ b/erpnext/setup/doctype/sales_person/sales_person.js @@ -27,12 +27,6 @@ cur_frm.fields_dict['parent_sales_person'].get_query = function(doc, cdt, cdn) { } } -cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { - return { - filters: { 'is_group': "No" } - } -} - cur_frm.fields_dict.employee.get_query = function(doc, cdt, cdn) { return { query: "erpnext.controllers.queries.employee_query" } } diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js index 2beecebea7..cde04b33aa 100644 --- a/erpnext/setup/doctype/territory/territory.js +++ b/erpnext/setup/doctype/territory/territory.js @@ -25,12 +25,4 @@ cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) { ['Territory', 'name', '!=', doc.territory_name] ] } -} - - -// ******************** ITEM Group ******************************** -cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'is_group': "No"} - } -} +} \ No newline at end of file From 4129ae5395d1ef066896a1442620ad935f0bfa34 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 Feb 2016 17:22:52 +0530 Subject: [PATCH 4/4] [fix] Translations in Stock balance report --- .../report/stock_balance/stock_balance.py | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py index 92e7adf50d..7d82da13fd 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.py +++ b/erpnext/stock/report/stock_balance/stock_balance.py @@ -35,11 +35,25 @@ def execute(filters=None): def get_columns(filters): """return columns based on filters""" - columns = ["Item:Link/Item:100", "Item Name::150", "Item Group::100", "Brand::90", \ - "Description::140", "Warehouse:Link/Warehouse:100", "Stock UOM:Link/UOM:90", "Opening Qty:Float:100", \ - "Opening Value:Float:110", "In Qty:Float:80", "In Value:Float:80", "Out Qty:Float:80", \ - "Out Value:Float:80", "Balance Qty:Float:100", "Balance Value:Float:100", \ - "Valuation Rate:Float:90", "Company:Link/Company:100"] + columns = [ + _("Item")+":Link/Item:100", + _("Item Name")+"::150", + _("Item Group")+"::100", + _("Brand")+"::90", + _("Description")+"::140", + _("Warehouse")+":Link/Warehouse:100", + _("Stock UOM")+":Link/UOM:90", + _("Opening Qty")+":Float:100", + _("Opening Value")+":Float:110", + _("In Qty")+":Float:80", + _("In Value")+":Float:80", + _("Out Qty")+":Float:80", + _("Out Value")+":Float:80", + _("Balance Qty")+":Float:100", + _("Balance Value")+":Float:100", + _("Valuation Rate")+":Float:90", + _("Company")+":Link/Company:100" + ] return columns