Merge branch 'develop' of github.com:frappe/erpnext into develop
diff --git a/.travis.yml b/.travis.yml
index 1e78ceb..59acb5c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,13 +18,14 @@
- pip install --editable .
script:
- cd ./test_sites/ &&
- frappe --use test_site &&
- frappe --reinstall &&
- frappe --install_app erpnext --verbose &&
- frappe --verbose --run_tests --app erpnext
+ - cd ./test_sites/
+ - frappe --use test_site
+ - frappe --reinstall
+ - frappe --install_app erpnext --verbose
+ - frappe -b
+ - frappe --serve_test &
+ - frappe --verbose --run_tests --app erpnext
before_script:
- - mysql -e 'create database test_site' &&
- - echo "USE mysql;\nUPDATE user SET password=PASSWORD('test_site') WHERE user='test_site';\nFLUSH PRIVILEGES;\n" | mysql -u root
-
+ - mysql -e 'create database test_frappe'
+ - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_setting/pos_setting.js
index 61c64c2..e2fe888 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.js
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.js
@@ -1,15 +1,20 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-cur_frm.cscript.onload = function(doc,cdt,cdn){
- return $c_obj(cur_frm.doc, 'get_series','',function(r,rt){
- if(r.message) set_field_options('naming_series', r.message);
+frappe.ui.form.on("POS Setting", "onload", function(frm) {
+ frm.set_query("selling_price_list", function() {
+ return { filter: { selling: 1 } };
});
-
- cur_frm.set_query("selling_price_list", function() {
- return { filters: { selling: 1 } };
+
+ frm.call({
+ method: "erpnext.accounts.doctype.pos_setting.pos_setting.get_series",
+ callback: function(r) {
+ if(!r.exc) {
+ set_field_options("naming_series", r.message);
+ }
+ }
});
-}
+});
//cash bank account
//------------------------------------
@@ -20,10 +25,10 @@
'group_or_ledger': "Ledger",
'company': doc.company
}
- }
+ }
}
-// Income Account
+// Income Account
// --------------------------------
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
return{
@@ -32,11 +37,11 @@
'company': doc.company,
'account_type': "Income Account"
}
- }
+ }
}
-// Cost Center
+// Cost Center
// -----------------------------
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
return{
@@ -44,11 +49,11 @@
'company': doc.company,
'group_or_ledger': "Ledger"
}
- }
+ }
}
-// Expense Account
+// Expense Account
// -----------------------------
cur_frm.fields_dict["expense_account"].get_query = function(doc) {
return {
@@ -65,8 +70,8 @@
return{
filters:[
['Print Heading', 'docstatus', '!=', 2]
- ]
- }
+ ]
+ }
}
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.json b/erpnext/accounts/doctype/pos_setting/pos_setting.json
index 2008277..a4f7fe3 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.json
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.json
@@ -1,5 +1,5 @@
{
- "autoname": "naming_series:",
+ "autoname": "POS/.####",
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"doctype": "DocType",
@@ -19,6 +19,7 @@
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
"fieldname": "territory",
"fieldtype": "Link",
+ "in_list_view": 1,
"label": "Territory",
"oldfieldname": "territory",
"oldfieldtype": "Link",
@@ -30,11 +31,12 @@
{
"fieldname": "naming_series",
"fieldtype": "Select",
+ "in_list_view": 1,
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
- "options": "POS-Setting-.#",
+ "options": "[Select]",
"permlevel": 0,
"read_only": 0,
"reqd": 1
@@ -42,6 +44,7 @@
{
"fieldname": "currency",
"fieldtype": "Link",
+ "in_list_view": 0,
"label": "Currency",
"oldfieldname": "currency",
"oldfieldtype": "Select",
@@ -92,6 +95,7 @@
{
"fieldname": "customer",
"fieldtype": "Link",
+ "in_list_view": 0,
"label": "Customer",
"oldfieldname": "customer_account",
"oldfieldtype": "Link",
@@ -201,7 +205,7 @@
],
"icon": "icon-cog",
"idx": 1,
- "modified": "2014-04-27 03:11:44.969097",
+ "modified": "2014-05-04 08:47:33.250720",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Setting",
@@ -210,7 +214,7 @@
{
"cancel": 0,
"create": 1,
- "delete": 0,
+ "delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_setting/pos_setting.py
index ba592b0..e17cd91 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.py
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.py
@@ -9,9 +9,6 @@
from frappe.model.document import Document
class POSSetting(Document):
- def get_series(self):
- frappe.get_meta("Sales Invoice").get_field("naming_series").options or ""
-
def validate(self):
self.check_for_duplicate()
self.validate_expense_account()
@@ -67,3 +64,7 @@
frappe.defaults.set_user_default("is_pos", 1, user)
else:
frappe.defaults.set_global_default("is_pos", 1)
+
+@frappe.whitelist()
+def get_series():
+ return frappe.get_meta("Sales Invoice").get_field("naming_series").options or ""
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
index 2f7727e..5592bc5 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
@@ -7,7 +7,8 @@
add_columns: [{"content":"Percent Paid", width:"10%", type:"bar-graph",
label: "Payment Received"}],
prepare_data: function(data) {
- data["Percent Paid"] = flt(data.grand_total) ? (((flt(data.grand_total) -
- flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0;
+ data["Percent Paid"] = (data.docstatus===1 && flt(data.grand_total))
+ ? (((flt(data.grand_total) - flt(data.outstanding_amount)) / flt(data.grand_total)) * 100)
+ : 0;
}
};
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 404dfa7..c088042 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -120,10 +120,8 @@
if not tax_master_doctype:
tax_master_doctype = self.meta.get_field(tax_master_field).options
- tax_doctype = self.meta.get_field(tax_parentfield).options
-
self.extend(tax_parentfield,
- get_taxes_and_charges(tax_doctype, self.get(tax_master_field)), tax_parentfield)
+ get_taxes_and_charges(tax_master_doctype, self.get(tax_master_field), tax_parentfield))
def set_other_charges(self):
self.set("other_charges", [])