Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 3ef27a4..e1f1f13 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-__version__ = '6.27.22'
+__version__ = '6.27.23'
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 9a90f2f..4bba066 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_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 c67a30f..9b316e4 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -14,6 +14,26 @@
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() {
@@ -174,25 +194,6 @@
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/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index a918cf3..9bf11df 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -8,7 +8,9 @@
customer: function(frm) {
erpnext.utils.get_party_details(frm);
},
- customer_address: erpnext.utils.get_address_display,
+ customer_address: function(frm, cdt, cdn){
+ erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
+ },
contact_person: erpnext.utils.get_contact_details,
enquiry_from: function(frm) {
frm.toggle_reqd("lead", frm.doc.enquiry_from==="Lead");
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index d2e95fa..8e6b7e6 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -177,7 +177,7 @@
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]) },
function(data) {
if(data.qty > max) {
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
index 650429c..b1cd3e2 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -5,10 +5,12 @@
frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
erpnext.utils.get_party_details(frm) });
-frappe.ui.form.on_change("Maintenance Schedule", "customer_address",
- erpnext.utils.get_address_display);
-frappe.ui.form.on_change("Maintenance Schedule", "contact_person",
- erpnext.utils.get_contact_details);
+frappe.ui.form.on_change("Maintenance Schedule", "customer_address", function(){
+ erpnext.utils.get_address_display(cur_frm, 'customer_address', 'address_display');
+});
+frappe.ui.form.on_change("Maintenance Schedule", "contact_person", function(){
+ erpnext.utils.get_contact_details(cur_frm);
+});
// TODO commonify this code
erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
index 65a84c0..c748bae 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
@@ -6,10 +6,12 @@
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
erpnext.utils.get_party_details(frm) });
-frappe.ui.form.on_change("Maintenance Visit", "customer_address",
- erpnext.utils.get_address_display);
-frappe.ui.form.on_change("Maintenance Visit", "contact_person",
- erpnext.utils.get_contact_details);
+frappe.ui.form.on_change("Maintenance Visit", "customer_address", function(frm){
+ erpnext.utils.get_address_display(frm, 'customer_address', 'address_display')
+});
+frappe.ui.form.on_change("Maintenance Visit", "contact_person", function(frm){
+ erpnext.utils.get_contact_details(frm)
+});
// TODO commonify this code
erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
@@ -87,4 +89,4 @@
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
return {query: "erpnext.controllers.queries.customer_query" }
-}
\ No newline at end of file
+}