Skip to content

Commit 8c72fa2

Browse files
committed
Merge branch 'develop'
2 parents b32cf35 + 0096240 commit 8c72fa2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+50222
-41366
lines changed

__init__.py

Whitespace-only changes.

erpnext/__init__.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from __future__ import unicode_literals
33
import frappe
44

5-
__version__ = '8.0.29'
5+
__version__ = '8.0.30'
6+
67

78
def get_default_company(user=None):
89
'''Get default company for user'''
@@ -19,12 +20,14 @@ def get_default_company(user=None):
1920

2021
return default_company
2122

23+
2224
def get_default_currency():
2325
'''Returns the currency of the default company'''
2426
company = get_default_company()
2527
if company:
2628
return frappe.db.get_value('Company', company, 'default_currency')
2729

30+
2831
def get_company_currency(company):
2932
'''Returns the default company currency'''
3033
if not frappe.flags.company_currency:
@@ -33,11 +36,13 @@ def get_company_currency(company):
3336
frappe.flags.company_currency[company] = frappe.db.get_value('Company', company, 'default_currency')
3437
return frappe.flags.company_currency[company]
3538

39+
3640
def set_perpetual_inventory(enable=1):
3741
accounts_settings = frappe.get_doc("Accounts Settings")
3842
accounts_settings.auto_accounting_for_stock = enable
3943
accounts_settings.save()
4044

45+
4146
def encode_company_abbr(name, company):
4247
'''Returns name encoded with company abbreviation'''
4348
company_abbr = frappe.db.get_value("Company", company, "abbr")
@@ -46,4 +51,6 @@ def encode_company_abbr(name, company):
4651
if parts[-1].lower() != company_abbr.lower():
4752
parts.append(company_abbr)
4853

49-
return " - ".join([parts[0], company_abbr])
54+
return " - ".join(parts)
55+
56+

erpnext/accounts/doctype/payment_request/payment_request.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@
681681
"print_hide_if_no_value": 0,
682682
"read_only": 1,
683683
"remember_last_selected_value": 0,
684-
"report_hide": 1,
684+
"report_hide": 0,
685685
"reqd": 0,
686686
"search_index": 0,
687687
"set_only_once": 0,
@@ -728,7 +728,7 @@
728728
"issingle": 0,
729729
"istable": 0,
730730
"max_attachments": 0,
731-
"modified": "2017-05-08 12:09:25.759145",
731+
"modified": "2017-05-18 12:18:39.187714",
732732
"modified_by": "Administrator",
733733
"module": "Accounts",
734734
"name": "Payment Request",

erpnext/accounts/report/financial_statements.py

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import unicode_literals
55
import frappe
6+
import re
67
from frappe import _
78
from frappe.utils import (flt, getdate, get_first_day, get_last_day, date_diff,
89
add_months, add_days, formatdate, cint)
@@ -277,6 +278,9 @@ def sort_root_accounts(roots):
277278
"""Sort root types as Asset, Liability, Equity, Income, Expense"""
278279

279280
def compare_roots(a, b):
281+
if re.split('\W+', a.value)[0].isdigit():
282+
# if chart of accounts is numbered, then sort by number
283+
return cmp(a.value, b.value)
280284
if a.report_type != b.report_type and a.report_type == "Balance Sheet":
281285
return -1
282286
if a.root_type != b.root_type and a.root_type == "Asset":

erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
3535
source_doctype: "Sales Order",
3636
target: me.frm,
3737
setters: {
38-
customer: me.frm.doc.customer || undefined,
39-
order_type: me.frm.doc.order_type,
38+
customer: me.frm.doc.customer || undefined
4039
},
4140
get_query_filters: {
4241
docstatus: 1,

erpnext/selling/doctype/sales_order/sales_order.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
138138
source_doctype: "Quotation",
139139
target: me.frm,
140140
setters: {
141-
customer: me.frm.doc.customer || undefined,
142-
order_type: me.frm.doc.order_type,
141+
customer: me.frm.doc.customer || undefined
143142
},
144143
get_query_filters: {
145144
company: me.frm.doc.company,

erpnext/shopping_cart/cart.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ def get_party(user=None):
315315

316316
else:
317317
if not cart_settings.enabled:
318-
return None
318+
frappe.local.flags.redirect_location = "/contact"
319+
raise frappe.Redirect
319320
customer = frappe.new_doc("Customer")
320321
fullname = get_fullname(user)
321322
customer.update({

erpnext/stock/doctype/warehouse/test_warehouse.py

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ def test_warehouse_renaming(self):
5959
self.assertTrue(frappe.db.get_value("Account",
6060
filters={"warehouse": "Test Warehouse for Renaming 3 - _TC"}))
6161

62+
# Another rename with multiple dashes
63+
if frappe.db.exists("Warehouse", "Test - Warehouse - Company - _TC"):
64+
frappe.delete_doc("Warehouse", "Test - Warehouse - Company - _TC")
65+
rename_doc("Warehouse", "Test Warehouse for Renaming 3 - _TC", "Test - Warehouse - Company")
66+
67+
self.assertTrue(frappe.db.exists("Account", "Test - Warehouse - Company - _TC"))
68+
self.assertTrue(frappe.db.get_value("Account", filters={"warehouse": "Test - Warehouse - Company - _TC"}))
69+
self.assertFalse(frappe.db.get_value("Account", filters={"warehouse": "Test Warehouse for Renaming 3 - _TC"}))
70+
6271
def test_warehouse_merging(self):
6372
set_perpetual_inventory(1)
6473

erpnext/tests/test_init.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import unittest
2+
3+
import frappe
4+
from erpnext import encode_company_abbr
5+
from six.moves import range
6+
7+
test_records = frappe.get_test_records('Company')
8+
9+
10+
class TestInit(unittest.TestCase):
11+
def test_encode_company_abbr(self):
12+
company = frappe.new_doc("Company")
13+
company.company_name = "New from Existing Company For Test"
14+
company.abbr = "NFECT"
15+
company.default_currency = "INR"
16+
company.save()
17+
18+
abbr = company.abbr
19+
20+
names = [
21+
"Warehouse Name", "ERPNext Foundation India", "Gold - Member - {a}".format(a=abbr),
22+
" - {a}".format(a=abbr), "ERPNext - Foundation - India",
23+
"ERPNext Foundation India - {a}".format(a=abbr),
24+
"No-Space-{a}".format(a=abbr), "- Warehouse"
25+
]
26+
27+
expected_names = [
28+
"Warehouse Name - {a}".format(a=abbr), "ERPNext Foundation India - {a}".format(a=abbr),
29+
"Gold - Member - {a}".format(a=abbr), " - {a}".format(a=abbr),
30+
"ERPNext - Foundation - India - {a}".format(a=abbr),
31+
"ERPNext Foundation India - {a}".format(a=abbr), "No-Space-{a} - {a}".format(a=abbr),
32+
"- Warehouse - {a}".format(a=abbr)
33+
]
34+
35+
for i in range(len(names)):
36+
enc_name = encode_company_abbr(names[i], company.name)
37+
self.assertTrue(
38+
enc_name == expected_names[i],
39+
"{enc} is not same as {exp}".format(enc=enc_name, exp=expected_names[i])
40+
)

0 commit comments

Comments
 (0)