Merge branch 'foreign_currency_calc' into v5.0
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
index 1c43b7e..5b47c4d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
@@ -6,13 +6,13 @@
add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"],
get_indicator: function(doc) {
- if(doc.outstanding_amount > 0 && doc.docstatus==1) {
+ if(flt(doc.outstanding_amount) > 0 && doc.docstatus==1) {
if(frappe.datetime.get_diff(doc.due_date) < 0) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<,Today"];
} else {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due,>=,Today"];
}
- } else if(doc.outstanding_amount==0 && doc.docstatus==1) {
+ } else if(flt(doc.outstanding_amount)==0 && doc.docstatus==1) {
return [__("Paid"), "green", "outstanding_amount,=,0"];
}
}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
index 01dcc0e..1bcc194 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
@@ -6,11 +6,11 @@
add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"],
get_indicator: function(doc) {
- if(doc.outstanding_amount==0) {
+ if(flt(doc.outstanding_amount)==0) {
return [__("Paid"), "green", "outstanding_amount,=,0"]
- } else if (doc.outstanding_amount > 0 && doc.due_date > frappe.datetime.get_today()) {
+ } else if (flt(doc.outstanding_amount) > 0 && doc.due_date > frappe.datetime.get_today()) {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"]
- } else if (doc.outstanding_amount > 0 && doc.due_date <= frappe.datetime.get_today()) {
+ } else if (flt(doc.outstanding_amount) > 0 && doc.due_date <= frappe.datetime.get_today()) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
}
},
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_list.js b/erpnext/buying/doctype/purchase_order/purchase_order_list.js
index b094a65..1b27b79 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order_list.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order_list.js
@@ -4,11 +4,11 @@
get_indicator: function(doc) {
if(doc.status==="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"];
- } else if(doc.per_received < 100 && doc.status!=="Stopped") {
+ } else if(flt(doc.per_received) < 100 && doc.status!=="Stopped") {
return [__("Not Received"), "orange", "per_received,<,100|status,!=,Stopped"];
- } else if(doc.per_received == 100 && doc.per_billed < 100 && doc.status!=="Stopped") {
+ } else if(flt(doc.per_received) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") {
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"];
- } else if(doc.per_received == 100 && doc.per_billed == 100 && doc.status!=="Stopped") {
+ } else if(flt(doc.per_received) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"];
}
}
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index def1585..744a0eb 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -52,8 +52,8 @@
break
def calculate_taxes_and_totals(self):
- from erpnext.controllers.taxes_and_totals import taxes_and_totals
- taxes_and_totals(self).calculate()
+ from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
+ calculate_taxes_and_totals(self)
if self.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
self.calculate_commission()
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 6e8d7f1..341b3ca 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -8,10 +8,12 @@
from erpnext.setup.utils import get_company_currency
from erpnext.controllers.accounts_controller import validate_conversion_rate
-class taxes_and_totals(object):
+class calculate_taxes_and_totals(object):
def __init__(self, doc):
self.doc = doc
+ self.calculate()
+
def calculate(self):
self.discount_amount_applied = False
self._calculate()
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
index 2b6c393..39634fe 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
@@ -1,6 +1,6 @@
{
"autoname": "PP/.SO/.#####",
- "creation": "2013-02-22 01:27:49.000000",
+ "creation": "2013-02-22 01:27:49",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@@ -29,6 +29,12 @@
"width": "120px"
},
{
+ "fieldname": "col_break1",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 1,
@@ -53,9 +59,10 @@
],
"idx": 1,
"istable": 1,
- "modified": "2013-12-20 19:23:25.000000",
+ "modified": "2015-02-17 14:29:14.479541",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan Sales Order",
- "owner": "Administrator"
+ "owner": "Administrator",
+ "permissions": []
}
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 85f5bda..6ea16db 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -97,6 +97,8 @@
execute:frappe.rename_doc("DocType", "Support Ticket", "Issue", force=True)
erpnext.patches.v5_0.set_default_company_in_bom
erpnext.patches.v5_0.capacity_planning
+execute:frappe.reload_doc('crm', 'doctype', 'lead')
+execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
erpnext.patches.v5_0.rename_table_fieldnames
execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
erpnext.patches.v4_2.party_model
@@ -108,6 +110,9 @@
erpnext.patches.v5_0.update_companywise_payment_account
erpnext.patches.v5_0.remove_birthday_events
erpnext.patches.v5_0.update_item_name_in_bom
+erpnext.patches.v5_0.rename_customer_issue
+erpnext.patches.v5_0.rename_total_fields
+erpnext.patches.v5_0.replace_renamed_fields_in_custom_script_and_print_formats
erpnext.patches.v5_0.new_crm_module
erpnext.patches.v5_0.rename_customer_issue
erpnext.patches.v5_0.update_material_transfer_for_manufacture
diff --git a/erpnext/patches/v5_0/manufacturing_activity_type.py b/erpnext/patches/v5_0/manufacturing_activity_type.py
index d4e7873..12bf296 100644
--- a/erpnext/patches/v5_0/manufacturing_activity_type.py
+++ b/erpnext/patches/v5_0/manufacturing_activity_type.py
@@ -4,10 +4,8 @@
import frappe
def execute():
- if not frappe.db.exists('Activity Type','Manufacturing') {
- doc = frappe.new_doc('Activity Type')
- doc.update({
- 'activity_type' : 'Manufacturing'
- })
- doc.save()
- }
\ No newline at end of file
+ if not frappe.db.exists('Activity Type','Manufacturing'):
+ frappe.get_doc({
+ "doctype": "Activity Type",
+ "activity_type": "Manufacturing"
+ }).insert()
diff --git a/erpnext/patches/v5_0/rename_customer_issue.py b/erpnext/patches/v5_0/rename_customer_issue.py
index c3c38a7..68bab3f 100644
--- a/erpnext/patches/v5_0/rename_customer_issue.py
+++ b/erpnext/patches/v5_0/rename_customer_issue.py
@@ -2,4 +2,4 @@
def execute():
if frappe.db.table_exists("tabCustomer Issue"):
- frappe.rename_doc("DocType", "Customer Issue", "Warrany Claim")
+ frappe.rename_doc("DocType", "Customer Issue", "Warranty Claim")
diff --git a/erpnext/patches/v5_0/rename_table_fieldnames.py b/erpnext/patches/v5_0/rename_table_fieldnames.py
index eed4c1c..5514a00 100644
--- a/erpnext/patches/v5_0/rename_table_fieldnames.py
+++ b/erpnext/patches/v5_0/rename_table_fieldnames.py
@@ -105,7 +105,6 @@
["experience_in_company_details", "internal_work_history"]
],
"Event": [
- ["event_individuals", "users"],
["event_roles", "roles"]
],
"Expense Claim": [
diff --git a/erpnext/patches/v5_0/rename_total_fields.py b/erpnext/patches/v5_0/rename_total_fields.py
index 946ad21..d9465fa 100644
--- a/erpnext/patches/v5_0/rename_total_fields.py
+++ b/erpnext/patches/v5_0/rename_total_fields.py
@@ -8,7 +8,7 @@
selling_doctypes = ("Quotation", "Sales Order", "Delivery Note", "Sales Invoice")
-selling_doctypes = ("Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice")
+buying_doctypes = ("Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice")
selling_renamed_fields = (
("net_total", "base_net_total"),
@@ -47,4 +47,5 @@
rename_field(dt, f[0], f[1])
# Added new field "total_taxes_and_charges" in buying cycle, updating value
- frappe.db.sql("update `tab{0}` set total_taxes_and_charges=round(base_total_taxes_and_charges/conversion_rate), 2")
+ frappe.db.sql("""update `tab{0}`
+ set total_taxes_and_charges = round(base_total_taxes_and_charges/conversion_rate, 2)""".format(dt))
diff --git a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py
index 46bb221..f8775c1 100644
--- a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py
+++ b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py
@@ -43,7 +43,7 @@
)
for fields in rename_map.values():
- renamed_fields += fields
+ renamed_fields += tuple(fields)
return renamed_fields
diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js
index eef9162..17681a3 100644
--- a/erpnext/selling/doctype/sales_order/sales_order_list.js
+++ b/erpnext/selling/doctype/sales_order/sales_order_list.js
@@ -4,13 +4,13 @@
get_indicator: function(doc) {
if(doc.status==="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"];
- } else if(doc.per_delivered < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) {
+ } else if(flt(doc.per_delivered) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) {
return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"];
- } else if(doc.per_delivered < 100 && doc.status!=="Stopped") {
+ } else if(flt(doc.per_delivered) < 100 && doc.status!=="Stopped") {
return [__("Not Delivered"), "orange", "per_delivered,<,100|status,!=,Stopped"];
- } else if(doc.per_delivered == 100 && doc.per_billed < 100 && doc.status!=="Stopped") {
+ } else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") {
return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"];
- } else if(doc.per_delivered == 100 && doc.per_billed == 100 && doc.status!=="Stopped") {
+ } else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"];
}
}
diff --git a/erpnext/stock/doctype/material_request/material_request_list.js b/erpnext/stock/doctype/material_request/material_request_list.js
index 1b9bca3..293d960 100644
--- a/erpnext/stock/doctype/material_request/material_request_list.js
+++ b/erpnext/stock/doctype/material_request/material_request_list.js
@@ -1,12 +1,11 @@
frappe.listview_settings['Material Request'] = {
add_fields: ["material_request_type", "status", "per_ordered"],
get_indicator: function(doc) {
- console.log()
if(doc.status=="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"];
- } else if(doc.docstatus==1 && doc.per_ordered < 100) {
+ } else if(doc.docstatus==1 && flt(doc.per_ordered) < 100) {
return [__("Pending"), "orange", "per_ordered,<,100"];
- } else if(doc.docstatus==1 && doc.per_ordered == 100) {
+ } else if(doc.docstatus==1 && flt(doc.per_ordered) == 100) {
return [__("Ordered"), "green", "per_ordered,=,100"];
}
}