Merge pull request #5446 from rohitwaghchaure/purchase_register_total_amount_issue
[Fixes] Purchase register, showing wrong value for total amount if tax has deducted.
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 60bec4f..3ef27a4 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -1 +1,4 @@
-from erpnext.__version__ import __version__
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+__version__ = '6.27.22'
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
deleted file mode 100644
index c27ae20..0000000
--- a/erpnext/__version__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from __future__ import unicode_literals
-__version__ = '6.27.22'
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/controllers/tests/__init__.py b/erpnext/controllers/tests/__init__.py
index 60bec4f..e69de29 100644
--- a/erpnext/controllers/tests/__init__.py
+++ b/erpnext/controllers/tests/__init__.py
@@ -1 +0,0 @@
-from erpnext.__version__ import __version__
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/hooks.py b/erpnext/hooks.py
index a94acff..184004c 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
from frappe import _
+from . import __version__ as app_version
app_name = "erpnext"
app_title = "ERPNext"
@@ -7,7 +8,6 @@
app_description = """ERP made simple"""
app_icon = "icon-th"
app_color = "#e74c3c"
-app_version = "6.27.22"
app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext"
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
+}
diff --git a/setup.py b/setup.py
index d592c5f..5dd87ab 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,15 @@
+# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from pip.req import parse_requirements
+import re, ast
-version = "6.27.22"
+# get version from __version__ variable in erpnext/__init__.py
+_version_re = re.compile(r'__version__\s+=\s+(.*)')
+
+with open('erpnext/__init__.py', 'rb') as f:
+ version = str(ast.literal_eval(_version_re.search(
+ f.read().decode('utf-8')).group(1)))
+
requirements = parse_requirements("requirements.txt", session="")
setup(