diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index 9a90f2f2354..4bba066f44e 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -147,10 +147,11 @@ def get_invoice_expense_map(invoice_list): def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts): tax_details = frappe.db.sql(""" - select parent, account_head, sum(base_tax_amount_after_discount_amount) as tax_amount + select parent, account_head, case add_deduct_tax when "Add" then sum(base_tax_amount_after_discount_amount) + else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount from `tabPurchase Taxes and Charges` where parent in (%s) and category in ('Total', 'Valuation and Total') - group by parent, account_head + group by parent, account_head, add_deduct_tax """ % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1) invoice_tax_map = {} diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 6416a239d2a..c6847156ee7 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -25,6 +25,26 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ onload: function() { this.setup_queries(); this._super(); + + if(this.frm.get_field('shipping_address')) { + this.frm.set_query("shipping_address", function(){ + if(me.frm.doc.customer){ + return{ + filters:{ + "customer": me.frm.doc.customer + } + } + } + else{ + return{ + filters:{ + "is_your_company_address": 1, + "company": me.frm.doc.company + } + } + } + }); + } }, setup_queries: function() { @@ -225,25 +245,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ shipping_address: function(){ var me = this; - - this.frm.set_query("shipping_address", function(){ - if(me.frm.doc.customer){ - return{ - filters:{ - "customer": me.frm.doc.customer - } - } - } - else{ - return{ - filters:{ - "is_your_company_address": 1, - "company": me.frm.doc.company - } - } - } - }); - erpnext.utils.get_address_display(this.frm, "shipping_address", "shipping_address_display", is_your_company_address=true) }, diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index e4bf46f4651..ba7026eff64 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -220,7 +220,7 @@ $.extend(cur_frm.cscript, { flt(this.frm.doc.material_transferred_for_manufacturing) - flt(this.frm.doc.produced_qty) : flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_manufacturing); - frappe.prompt({fieldtype:"Int", label: __("Qty for {0}", [purpose]), fieldname:"qty", + frappe.prompt({fieldtype:"Float", label: __("Qty for {0}", [purpose]), fieldname:"qty", description: __("Max: {0}", [max]), 'default': max }, function(data) { if(data.qty > max) {