Merge pull request #4632 from nabinhait/pos_fix
Calculate change in POS based on smallest currency fraction value
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 69f5e8a..1725b7e 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -437,9 +437,11 @@
})
if(cur_frm.doc.is_pos) {
- cur_frm.msgbox = frappe.msgprint('<a class="btn btn-primary" \
- onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">Print</a>\
- <a class="btn btn-default" href="#Form/Sales Invoice/New Sales Invoice">New</a>');
+ cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \
+ onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\
+ <a class="btn btn-default" href="javascript:new_doc(cur_frm.doctype);">{1}</a>', [
+ __('Print'), __('New')
+ ]));
} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
diff --git a/erpnext/projects/doctype/time_log/test_time_log.py b/erpnext/projects/doctype/time_log/test_time_log.py
index 1894e37..8d5694f 100644
--- a/erpnext/projects/doctype/time_log/test_time_log.py
+++ b/erpnext/projects/doctype/time_log/test_time_log.py
@@ -105,7 +105,7 @@
task_name = frappe.db.get_value("Task",{"project": "_Test Project 1"})
time_log = make_time_log_test_record(employee="_T-Employee-0002", hours=2,
- task=task_name)
+ task=task_name, simulate=1)
self.assertEqual(time_log.costing_rate, 50)
self.assertEqual(time_log.costing_amount, 100)
self.assertEqual(time_log.billing_rate, 100)
@@ -115,7 +115,7 @@
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 200)
time_log2 = make_time_log_test_record(employee="_T-Employee-0002",
- hours=2, task= task_name, from_time = now_datetime() + datetime.timedelta(hours= 3))
+ hours=2, task= task_name, from_time = now_datetime() + datetime.timedelta(hours= 3), simulate=1)
self.assertEqual(frappe.db.get_value("Task", task_name, "total_billing_amount"), 400)
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 400)
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index c2239df..6763209 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
-from frappe.utils import cstr, flt, get_datetime, get_time, getdate
+from frappe.utils import flt, get_datetime, get_time, getdate
from dateutil.relativedelta import relativedelta
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
@@ -93,14 +93,12 @@
(%(from_time)s > from_time and %(from_time)s < to_time) or
(%(from_time)s = from_time and %(to_time)s = to_time))
and name!=%(name)s
- and ifnull(task, "")=%(task)s
and docstatus < 2""".format(fieldname),
{
"val": self.get(fieldname),
"from_time": self.from_time,
"to_time": self.to_time,
- "name": self.name or "No Name",
- "task": cstr(self.task)
+ "name": self.name or "No Name"
}, as_dict=True)
return existing[0] if existing else None
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 9d6f590..3437463 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -236,11 +236,11 @@
},
s_warehouse: function(doc, cdt, cdn) {
-
+ this.get_warehouse_details(doc, cdt, cdn)
},
t_warehouse: function(doc, cdt, cdn) {
- this.s_warehouse(doc, cdt, cdn);
+ this.get_warehouse_details(doc, cdt, cdn)
},
get_warehouse_details: function(doc, cdt, cdn) {