Merge branch 'develop' of github.com:webnotes/erpnext into hotfix
diff --git a/hr/report/monthly_salary_register/monthly_salary_register.js b/hr/report/monthly_salary_register/monthly_salary_register.js
index 5d3abcc..32b4ef3 100644
--- a/hr/report/monthly_salary_register/monthly_salary_register.js
+++ b/hr/report/monthly_salary_register/monthly_salary_register.js
@@ -7,7 +7,7 @@
"fieldname":"month",
"label": wn._("Month"),
"fieldtype": "Select",
- "options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
+ "options": "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
},
diff --git a/hr/report/monthly_salary_register/monthly_salary_register.py b/hr/report/monthly_salary_register/monthly_salary_register.py
index 8bd8f36..9b8a84f 100644
--- a/hr/report/monthly_salary_register/monthly_salary_register.py
+++ b/hr/report/monthly_salary_register/monthly_salary_register.py
@@ -59,8 +59,8 @@
def get_salary_slips(filters):
conditions, filters = get_conditions(filters)
- salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s""" %
- conditions, filters, as_dict=1)
+ salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
+ order by employee, month""" % conditions, filters, as_dict=1)
if not salary_slips:
msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) +
diff --git a/patches/1401/p01_move_related_property_setters_to_custom_field.py b/patches/1401/p01_move_related_property_setters_to_custom_field.py
new file mode 100644
index 0000000..6b28553
--- /dev/null
+++ b/patches/1401/p01_move_related_property_setters_to_custom_field.py
@@ -0,0 +1,35 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+import webnotes
+from webnotes.model.meta import get_field
+
+def execute():
+ webnotes.reload_doc("core", "doctype", "custom_field")
+
+ custom_fields = {}
+ for cf in webnotes.conn.sql("""select dt, fieldname from `tabCustom Field`""", as_dict=1):
+ custom_fields.setdefault(cf.dt, []).append(cf.fieldname)
+
+ delete_list = []
+ for ps in webnotes.conn.sql("""select * from `tabProperty Setter`""", as_dict=1):
+ if ps.field_name in custom_fields.get(ps.doc_type, []):
+
+ if ps.property == "previous_field":
+ property_name = "insert_after"
+
+ field_meta = get_field(ps.doc_type, ps.value)
+ property_value = field_meta.label if field_meta else ""
+ else:
+ property_name = ps.property
+ property_value =ps.value
+
+ webnotes.conn.sql("""update `tabCustom Field`
+ set %s=%s where dt=%s and fieldname=%s""" % (property_name, '%s', '%s', '%s'),
+ (property_value, ps.doc_type, ps.field_name))
+
+ delete_list.append(ps.name)
+
+ if delete_list:
+ webnotes.conn.sql("""delete from `tabProperty Setter` where name in (%s)""" %
+ ', '.join(['%s']*len(delete_list)), tuple(delete_list))
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index d291d76..04a9288 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -263,5 +263,6 @@
"patches.1311.p08_email_digest_recipients",
"execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
"patches.1312.p02_update_item_details_in_item_price",
+ "patches.1401.p01_move_related_property_setters_to_custom_field",
"patches.1401.p01_make_buying_selling_as_check_box_in_price_list",
]
\ No newline at end of file
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index 12281b4..88d9dca 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -5,7 +5,7 @@
import webnotes
from webnotes import _, msgprint
-from webnotes.utils import cstr
+from webnotes.utils import cstr, cint
import webnotes.defaults
@@ -237,21 +237,28 @@
account.insert()
def set_default_accounts(self):
- accounts = {
+ def _set_default_accounts(accounts):
+ for a in accounts:
+ account_name = accounts[a] + " - " + self.doc.abbr
+ if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
+ webnotes.conn.set(self.doc, a, account_name)
+
+ _set_default_accounts({
"default_income_account": "Sales",
"default_expense_account": "Cost of Goods Sold",
"receivables_group": "Accounts Receivable",
"payables_group": "Accounts Payable",
- "default_cash_account": "Cash",
- "stock_received_but_not_billed": "Stock Received But Not Billed",
- "stock_adjustment_account": "Stock Adjustment",
- "expenses_included_in_valuation": "Expenses Included In Valuation"
- }
+ "default_cash_account": "Cash"
+ })
- for a in accounts:
- account_name = accounts[a] + " - " + self.doc.abbr
- if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
- webnotes.conn.set(self.doc, a, account_name)
+ if cint(webnotes.conn.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
+ _set_default_accounts({
+ "stock_received_but_not_billed": "Stock Received But Not Billed",
+ "stock_adjustment_account": "Stock Adjustment",
+ "expenses_included_in_valuation": "Expenses Included In Valuation"
+ })
+
+
def create_default_cost_center(self):
cc_list = [