diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 67cff5dcba..9049b135b4 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '5.2.0' +__version__ = '5.2.1' diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index 8146c63638..e60d9abe15 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -173,7 +173,7 @@ "icon": "icon-money", "idx": 1, "in_create": 0, - "modified": "2015-06-14 20:57:55.471334", + "modified": "2015-07-20 03:54:14.297995", "modified_by": "Administrator", "module": "Accounts", "name": "Account", @@ -257,5 +257,5 @@ "write": 1 } ], - "search_fields": "is_group" + "search_fields": "" } \ No newline at end of file diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 3ea92e1b19..1ecde6493e 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -109,7 +109,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ against_jv: function(doc, cdt, cdn) { var d = frappe.get_doc(cdt, cdn); - if (d.against_jv && d.party && !flt(d.credit) && !flt(d.debit)) { + if (d.against_jv && !flt(d.credit) && !flt(d.debit)) { this.get_outstanding('Journal Entry', d.against_jv, d); } }, @@ -119,7 +119,8 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ var args = { "doctype": doctype, "docname": docname, - "party": child.party + "party": child.party, + "account": child.account } return this.frm.call({ diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 23d4c7380e..dc620edcf0 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -545,12 +545,14 @@ def get_against_jv(doctype, txt, searchfield, start, page_len, filters): @frappe.whitelist() def get_outstanding(args): args = eval(args) - if args.get("doctype") == "Journal Entry" and args.get("party"): + if args.get("doctype") == "Journal Entry": + condition = " and party=%(party)s" if args.get("party") else "" + against_jv_amount = frappe.db.sql(""" select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) - from `tabJournal Entry Account` where parent=%s and party=%s + from `tabJournal Entry Account` where parent=%(docname)s and account=%(account)s {0} and ifnull(against_invoice, '')='' and ifnull(against_voucher, '')='' - and ifnull(against_jv, '')=''""", (args['docname'], args['party'])) + and ifnull(against_jv, '')=''""".format(condition), args) against_jv_amount = flt(against_jv_amount[0][0]) if against_jv_amount else 0 if against_jv_amount > 0: diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index b0c73457d9..498d100a12 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -64,7 +64,7 @@ def get_data(): "type": "module" }, "Learn": { - "color": "#7272FF", + "color": "#FCB868", "force_show": True, "icon": "icon-facetime-video", "type": "module", diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 3418b9f7e5..a87c8f092e 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "5.2.0" +app_version = "5.2.1" error_report_email = "support@erpnext.com" diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index b556172a78..a56929d1c3 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -19,10 +19,13 @@ erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({ jv.company = cur_frm.doc.company; jv.remark = 'Payment against Expense Claim: ' + cur_frm.doc.name; jv.fiscal_year = cur_frm.doc.fiscal_year; - - var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts'); - d1.debit = cur_frm.doc.total_sanctioned_amount; - d1.against_expense_claim = cur_frm.doc.name; + var expense = cur_frm.doc.expenses || []; + for(var i = 0; i < expense.length; i++){ + var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts'); + d1.debit = expense[i].sanctioned_amount; + d1.account = expense[i].default_account; + d1.against_expense_claim = cur_frm.doc.name; + } // credit to bank var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts'); @@ -43,6 +46,7 @@ $.extend(cur_frm.cscript, new erpnext.hr.ExpenseClaimController({frm: cur_frm})) cur_frm.add_fetch('employee', 'company', 'company'); cur_frm.add_fetch('employee','employee_name','employee_name'); +cur_frm.add_fetch('expense_type', 'default_account', 'default_account'); cur_frm.cscript.onload = function(doc,cdt,cdn) { if(!doc.approval_status) diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json index c6123eeeff..9522d94207 100644 --- a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json +++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json @@ -34,6 +34,18 @@ "reqd": 1, "width": "150px" }, + { + "depends_on": "expense_type", + "fieldname": "default_account", + "fieldtype": "Link", + "hidden": 1, + "label": "Default Account", + "options": "Account", + "permlevel": 0, + "precision": "", + "read_only": 1, + "unique": 0 + }, { "fieldname": "section_break_4", "fieldtype": "Section Break", @@ -93,7 +105,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-04-08 06:18:47.539134", + "modified": "2015-07-16 06:13:32.090048", "modified_by": "Administrator", "module": "HR", "name": "Expense Claim Detail", diff --git a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json index fc7e604dba..0b0d304644 100644 --- a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json +++ b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json @@ -17,6 +17,14 @@ "reqd": 1, "search_index": 0 }, + { + "fieldname": "default_account", + "fieldtype": "Link", + "label": "Default Account", + "options": "Account", + "permlevel": 0, + "precision": "" + }, { "fieldname": "description", "fieldtype": "Small Text", @@ -29,7 +37,7 @@ ], "icon": "icon-flag", "idx": 1, - "modified": "2015-07-13 04:46:38.897484", + "modified": "2015-07-15 08:57:23.069980", "modified_by": "Administrator", "module": "HR", "name": "Expense Claim Type", @@ -55,7 +63,7 @@ "print": 0, "read": 1, "report": 0, - "role": "Employee", + "role": "All", "share": 0, "write": 0 } diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index 1a70f45223..d6f865ba9f 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -9,8 +9,13 @@ from frappe.desk.reportview import execute as runreport def execute(filters=None): if not filters: filters = {} - employee_filters = filters.get("company") and \ - [["Employee", "company", "=", filters.get("company")]] or None + employee_filters = { + "status": "Active" + } + + if filters.get("company"): + filters["company"] = filters.company + employees = runreport(doctype="Employee", fields=["name", "employee_name", "department"], filters=employee_filters, limit_page_length=None) diff --git a/erpnext/patches/v4_0/fields_to_be_renamed.py b/erpnext/patches/v4_0/fields_to_be_renamed.py index 2baab97b0a..cc17697132 100644 --- a/erpnext/patches/v4_0/fields_to_be_renamed.py +++ b/erpnext/patches/v4_0/fields_to_be_renamed.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe.model import rename_field +from frappe.model.utils.rename_field import rename_field from frappe.modules import scrub, get_doctype_module rename_map = { diff --git a/erpnext/patches/v5_0/rename_table_fieldnames.py b/erpnext/patches/v5_0/rename_table_fieldnames.py index c26accbf74..05d5c913c9 100644 --- a/erpnext/patches/v5_0/rename_table_fieldnames.py +++ b/erpnext/patches/v5_0/rename_table_fieldnames.py @@ -2,7 +2,7 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.model import rename_field +from frappe.model.utils.rename_field import rename_field from frappe.modules import scrub, get_doctype_module rename_map = { diff --git a/erpnext/patches/v5_0/rename_total_fields.py b/erpnext/patches/v5_0/rename_total_fields.py index cf95caa708..6657dd843e 100644 --- a/erpnext/patches/v5_0/rename_total_fields.py +++ b/erpnext/patches/v5_0/rename_total_fields.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe.model import rename_field +from frappe.model.utils.rename_field import rename_field from frappe.modules import scrub, get_doctype_module selling_doctypes = ("Quotation", "Sales Order", "Delivery Note", "Sales Invoice") diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index d9a611eed6..4e870fa59b 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -5,42 +5,59 @@ frappe.provide("erpnext.projects"); cur_frm.add_fetch("project", "company", "company"); -erpnext.projects.Task = frappe.ui.form.Controller.extend({ - setup: function() { - this.frm.fields_dict.project.get_query = function() { +frappe.ui.form.on("Task", { + refresh: function(frm) { + var doc = frm.doc; + if(!doc.__islocal) { + if(frappe.model.can_read("Time Log")) { + frm.add_custom_button(__("Time Logs"), function() { + frappe.route_options = {"project": doc.project, "task": doc.name} + frappe.set_route("List", "Time Log"); + }, "icon-list", true); + } + if(frappe.model.can_read("Expense Claim")) { + frm.add_custom_button(__("Expense Claims"), function() { + frappe.route_options = {"project": doc.project, "task": doc.name} + frappe.set_route("List", "Expense Claim"); + }, "icon-list", true); + } + + if(frm.perm[0].write) { + if(frm.doc.status==="Open") { + frm.add_custom_button("Close", function() { + frm.set_value("status", "Closed"); + frm.save(); + }); + } else { + frm.add_custom_button("Reopen", function() { + frm.set_value("status", "Open"); + frm.save(); + }); + } + } + } + }, + + setup: function(frm) { + frm.fields_dict.project.get_query = function() { return { query: "erpnext.projects.doctype.task.task.get_project" } }; }, - project: function() { - if(this.frm.doc.project) { - return get_server_fields('get_project_details', '','', this.frm.doc, this.frm.doc.doctype, - this.frm.doc.name, 1); + project: function(frm) { + if(frm.doc.project) { + return get_server_fields('get_project_details', '','', frm.doc, frm.doc.doctype, + frm.doc.name, 1); } }, - validate: function() { - this.frm.doc.project && frappe.model.remove_from_locals("Project", - this.frm.doc.project); + validate: function(frm) { + frm.doc.project && frappe.model.remove_from_locals("Project", + frm.doc.project); }, - - refresh: function(doc) { - if(!doc.__islocal) { - cur_frm.add_custom_button(__("Time Logs"), function() { - frappe.route_options = {"project": doc.project, "task": doc.name} - frappe.set_route("List", "Time Log"); - }, "icon-list", true); - cur_frm.add_custom_button(__("Expense Claims"), function() { - frappe.route_options = {"project": doc.project, "task": doc.name} - frappe.set_route("List", "Expense Claim"); - }, "icon-list", true); - } - } + }); cur_frm.add_fetch('task', 'subject', 'subject'); - -cur_frm.cscript = new erpnext.projects.Task({frm: cur_frm}); - diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css index b5f2a2d1e2..3c286b162e 100644 --- a/erpnext/public/css/erpnext.css +++ b/erpnext/public/css/erpnext.css @@ -96,3 +96,8 @@ .pos .tax-table { margin-bottom: 10px; } +.erpnext-icon { + width: 24px; + margin-right: 0px; + margin-top: -3px; +} diff --git a/erpnext/public/images/erp-icon.svg b/erpnext/public/images/erp-icon.svg new file mode 100644 index 0000000000..b4e2a24b4e --- /dev/null +++ b/erpnext/public/images/erp-icon.svg @@ -0,0 +1,46 @@ + + + + diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index 626401929a..af06b33f58 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -11,7 +11,7 @@ $(document).bind('toolbar_setup', function() { href="https://discuss.erpnext.com">Feedback
' - $('.navbar-home').html('ERPNext'); + $('.navbar-home').html('