From 78352d1e7176cad8acbbc8db6277d9901cefab2d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 17:09:11 +0530 Subject: [PATCH 01/11] leave application permissions patch - removed permlevel 2 --- .../leave_application/leave_application.txt | 37 ++++++++----------- .../february_2013/p05_leave_application.py | 9 +++++ patches/patch_list.py | 1 + 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 patches/february_2013/p05_leave_application.py diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt index f51a91a2f7b..32d4cc51014 100644 --- a/hr/doctype/leave_application/leave_application.txt +++ b/hr/doctype/leave_application/leave_application.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-02-08 13:17:08", + "creation": "2013-02-18 13:36:20", "docstatus": 0, - "modified": "2013-02-13 12:32:27", + "modified": "2013-02-18 16:59:53", "modified_by": "Administrator", "owner": "Administrator" }, @@ -44,7 +44,7 @@ "label": "Status", "no_copy": 1, "options": "Open\nApproved\nRejected", - "permlevel": 2 + "permlevel": 1 }, { "description": "Leave can be approved by users with Role, \"Leave Approver\"", @@ -217,15 +217,6 @@ "role": "Employee", "write": 1 }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "role": "All", - "submit": 0 - }, { "amend": 1, "cancel": 1, @@ -254,8 +245,17 @@ "cancel": 0, "create": 0, "doctype": "DocPerm", - "permlevel": 2, - "report": 1, + "permlevel": 1, + "role": "All", + "submit": 0 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, "role": "HR User", "submit": 0, "write": 1 @@ -265,15 +265,10 @@ "cancel": 0, "create": 0, "doctype": "DocPerm", - "permlevel": 2, - "report": 1, + "permlevel": 1, + "report": 0, "role": "Leave Approver", "submit": 0, "write": 1 - }, - { - "doctype": "DocPerm", - "permlevel": 2, - "role": "Employee" } ] \ No newline at end of file diff --git a/patches/february_2013/p05_leave_application.py b/patches/february_2013/p05_leave_application.py new file mode 100644 index 00000000000..88d166e6132 --- /dev/null +++ b/patches/february_2013/p05_leave_application.py @@ -0,0 +1,9 @@ +import webnotes + +def execute(): + webnotes.reload_doc("hr", "doctype", "leave_application") + + if not webnotes.get_doctype("Leave Application").get({"doctype": "DocField", + "parent": "Leave Application", "permlevel": 2}): + webnotes.conn.sql("""update `tabDocPerm` set permlevel=1 + where parent="Leave Application" and permlevel=2""") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 472360ed1ad..6f21d5df85a 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -173,4 +173,5 @@ patch_list = [ "patches.february_2013.p01_event", "execute:webnotes.delete_doc('Page', 'Calendar')", "patches.february_2013.p02_email_digest", + "patches.february_2013.p05_leave_application", ] \ No newline at end of file From 17bc54107fa19ba9cdbdbee2c4341bd908d2aca1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 18:02:47 +0530 Subject: [PATCH 02/11] make leave application importable --- hr/doctype/leave_application/leave_application.py | 6 ++---- hr/doctype/leave_application/leave_application.txt | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index 06652ad66d0..472efe28e64 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -20,7 +20,6 @@ from webnotes import _ from webnotes.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_url_to_form, get_fullname from webnotes import msgprint -from webnotes.utils.email_lib import sendmail class LeaveDayBlockedError(Exception): pass @@ -33,7 +32,6 @@ class DocType(DocListController): self.previous_doc = None def validate(self): - # if self.doc.leave_approver == self.doc.owner: self.validate_to_date() self.validate_balance_leaves() self.validate_leave_overlap() @@ -41,8 +39,8 @@ class DocType(DocListController): self.validate_block_days() def on_update(self): - if (not self.previous_doc and self.doc.leave_approver) or (self.doc.status == "Open" \ - and self.previous_doc.leave_approver != self.doc.leave_approver): + if (not self.previous_doc and self.doc.leave_approver) or (self.previous_doc and \ + self.doc.status == "Open" and self.previous_doc.leave_approver != self.doc.leave_approver): # notify leave approver about creation self.notify_leave_approver() elif self.previous_doc and \ diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt index 32d4cc51014..cda0eb533f1 100644 --- a/hr/doctype/leave_application/leave_application.txt +++ b/hr/doctype/leave_application/leave_application.txt @@ -1,12 +1,13 @@ [ { - "creation": "2013-02-18 13:36:20", + "creation": "2013-02-18 17:08:32", "docstatus": 0, - "modified": "2013-02-18 16:59:53", + "modified": "2013-02-18 17:20:23", "modified_by": "Administrator", "owner": "Administrator" }, { + "allow_import": 1, "autoname": "LAP/.#####", "description": "Apply / Approve Leaves", "doctype": "DocType", From b54b22734f460a65a9469d30248a32f91b15b8fb Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 18:33:20 +0530 Subject: [PATCH 03/11] fixed leave application error -- take employee name from employee record --- hr/doctype/leave_application/leave_application.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index 472efe28e64..964d3ffd332 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -18,7 +18,7 @@ from __future__ import unicode_literals import webnotes from webnotes import _ -from webnotes.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_url_to_form, get_fullname +from webnotes.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_url_to_form from webnotes import msgprint class LeaveDayBlockedError(Exception): pass @@ -163,7 +163,7 @@ class DocType(DocListController): def _get_message(url=False): name = self.doc.name - employee_name = get_fullname(employee.user_id) + employee_name = employee.employee_name if url: name = get_url_to_form(self.doc.doctype, self.doc.name) employee_name = get_url_to_form("Employee", self.doc.employee, label=employee_name) From 62ef71be5781b5ff5fe0f1e5ea556bd1361aa587 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 18:38:36 +0530 Subject: [PATCH 04/11] added leave application to allow import list --- hr/doctype/leave_application/leave_application.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt index cda0eb533f1..1e1912873cd 100644 --- a/hr/doctype/leave_application/leave_application.txt +++ b/hr/doctype/leave_application/leave_application.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-18 17:08:32", "docstatus": 0, - "modified": "2013-02-18 17:20:23", + "modified": "2013-02-18 17:20:50", "modified_by": "Administrator", "owner": "Administrator" }, From d19e2f56cc7a411fcc9650091ff1e27613378e9e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 19:15:56 +0530 Subject: [PATCH 05/11] make sure employee name is a string --- hr/doctype/leave_application/leave_application.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index 964d3ffd332..f2687047442 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -163,7 +163,7 @@ class DocType(DocListController): def _get_message(url=False): name = self.doc.name - employee_name = employee.employee_name + employee_name = cstr(employee.employee_name) if url: name = get_url_to_form(self.doc.doctype, self.doc.name) employee_name = get_url_to_form("Employee", self.doc.employee, label=employee_name) @@ -250,7 +250,7 @@ def add_department_leaves(events, start, end, employee, company): "from_date": d.from_date, "to_date": d.to_date, "status": d.status, - "title": _("Leave by") + " " + d.employee_name + \ + "title": _("Leave by") + " " + cstr(d.employee_name) + \ (d.half_day and _(" (Half Day)") or "") }) From ac1985ff68bee3b01badb97c470ce5ef4f05af00 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 19:42:02 +0530 Subject: [PATCH 06/11] added observer for employee doctype to update salary structure --- hr/helpers/__init__.py | 0 hr/helpers/employee.py | 27 +++++++++++++++++++++++++++ startup/observers.py | 1 + 3 files changed, 28 insertions(+) create mode 100644 hr/helpers/__init__.py create mode 100644 hr/helpers/employee.py diff --git a/hr/helpers/__init__.py b/hr/helpers/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/hr/helpers/employee.py b/hr/helpers/employee.py new file mode 100644 index 00000000000..545b59540cf --- /dev/null +++ b/hr/helpers/employee.py @@ -0,0 +1,27 @@ +# ERPNext - web based ERP (http://erpnext.com) +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +def update_employee_details(controller, method=None): + """update employee details in linked doctypes""" + if method == "on_update" and controller.doc.doctype == "Employee": + # update salary structure + active_salary_structure = webnotes.conn.get_value("Salary Structure", + {"is_active": "Yes", "employee": controller.doc.name}) + if not active_salary_structure: + return + + ss = webnotes.model_wrapper("Salary Structure", active_salary_structure) + ss_doctype = webnotes.get_doctype("Salary Structure") + update = False + for fieldname, value in controller.doc.fields.items(): + if ss_doctype.get_field(fieldname) and ss.doc.fields[fieldname] != value: + ss.doc.fields[fieldname] = value + update = True + + if update: + ss.save() + + \ No newline at end of file diff --git a/startup/observers.py b/startup/observers.py index 46683f8d9b2..1a3edac5520 100644 --- a/startup/observers.py +++ b/startup/observers.py @@ -17,5 +17,6 @@ observer_map = { "*:on_update": "home.update_feed", "*:on_submit": "home.update_feed", + "Employee:on_update": "hr.helpers.employee.update_employee_details" # "*:on_update": "webnotes.widgets.moduleview.update_count" } \ No newline at end of file From 6ad06f3210b6b56edc176e27cb3009eea71c4d7f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 19:57:16 +0530 Subject: [PATCH 07/11] fixes in employee helper --- hr/helpers/employee.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/hr/helpers/employee.py b/hr/helpers/employee.py index 545b59540cf..9a7eb3f3683 100644 --- a/hr/helpers/employee.py +++ b/hr/helpers/employee.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import webnotes +from webnotes.model.doc import copy_common_fields def update_employee_details(controller, method=None): """update employee details in linked doctypes""" @@ -14,14 +15,5 @@ def update_employee_details(controller, method=None): return ss = webnotes.model_wrapper("Salary Structure", active_salary_structure) - ss_doctype = webnotes.get_doctype("Salary Structure") - update = False - for fieldname, value in controller.doc.fields.items(): - if ss_doctype.get_field(fieldname) and ss.doc.fields[fieldname] != value: - ss.doc.fields[fieldname] = value - update = True - - if update: - ss.save() - - \ No newline at end of file + copy_common_fields(controller.doc, ss.doc) + ss.save() From 22d3a8b41bc926a4a4a909c1a09dfc5e708596ae Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 19 Feb 2013 08:45:22 +0530 Subject: [PATCH 08/11] fetch docstatus in leave application for calendar view; fix in leave application test --- hr/doctype/leave_application/leave_application.py | 5 +++-- hr/doctype/leave_application/test_leave_application.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index f2687047442..4ad1c23bbac 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -237,7 +237,7 @@ def add_department_leaves(events, start, end, employee, company): department) for d in webnotes.conn.sql("""select name, from_date, to_date, employee_name, half_day, - status, employee + status, employee, docstatus from `tabLeave Application` where (from_date between %s and %s or to_date between %s and %s) and docstatus < 2 @@ -251,7 +251,8 @@ def add_department_leaves(events, start, end, employee, company): "to_date": d.to_date, "status": d.status, "title": _("Leave by") + " " + cstr(d.employee_name) + \ - (d.half_day and _(" (Half Day)") or "") + (d.half_day and _(" (Half Day)") or ""), + "docstatus": d.docstatus }) diff --git a/hr/doctype/leave_application/test_leave_application.py b/hr/doctype/leave_application/test_leave_application.py index 584549add3f..ff515b2e481 100644 --- a/hr/doctype/leave_application/test_leave_application.py +++ b/hr/doctype/leave_application/test_leave_application.py @@ -17,6 +17,7 @@ class TestLeaveApplication(unittest.TestCase): application = self.get_application(test_records[1]) application.insert() + application.doc.status = "Approved" self.assertRaises(LeaveDayBlockedError, application.submit) webnotes.session.user = "test1@example.com" From fe787259b65313941276e9258541d1274cb2715b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 Feb 2013 12:56:12 +0530 Subject: [PATCH 09/11] removed observer function for employee --- hr/helpers/__init__.py | 0 hr/helpers/employee.py | 19 ------------------- startup/observers.py | 1 - 3 files changed, 20 deletions(-) delete mode 100644 hr/helpers/__init__.py delete mode 100644 hr/helpers/employee.py diff --git a/hr/helpers/__init__.py b/hr/helpers/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hr/helpers/employee.py b/hr/helpers/employee.py deleted file mode 100644 index 9a7eb3f3683..00000000000 --- a/hr/helpers/employee.py +++ /dev/null @@ -1,19 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# For license information, please see license.txt - -from __future__ import unicode_literals -import webnotes -from webnotes.model.doc import copy_common_fields - -def update_employee_details(controller, method=None): - """update employee details in linked doctypes""" - if method == "on_update" and controller.doc.doctype == "Employee": - # update salary structure - active_salary_structure = webnotes.conn.get_value("Salary Structure", - {"is_active": "Yes", "employee": controller.doc.name}) - if not active_salary_structure: - return - - ss = webnotes.model_wrapper("Salary Structure", active_salary_structure) - copy_common_fields(controller.doc, ss.doc) - ss.save() diff --git a/startup/observers.py b/startup/observers.py index 1a3edac5520..46683f8d9b2 100644 --- a/startup/observers.py +++ b/startup/observers.py @@ -17,6 +17,5 @@ observer_map = { "*:on_update": "home.update_feed", "*:on_submit": "home.update_feed", - "Employee:on_update": "hr.helpers.employee.update_employee_details" # "*:on_update": "webnotes.widgets.moduleview.update_count" } \ No newline at end of file From a95e2db5b61257e66254d3ab94578e74db2c546a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 19 Feb 2013 15:09:21 +0530 Subject: [PATCH 10/11] leave application calendar: add leaves based on permission; add holidays applicable to the employee --- .../leave_application/leave_application.py | 82 +++++++++++++------ 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index 4ad1c23bbac..5170e26c251 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -103,9 +103,7 @@ class DocType(DocListController): raise Exception def validate_balance_leaves(self): - if self.doc.from_date and self.doc.to_date and not is_lwp(self.doc.leave_type): - self.doc.leave_balance = get_leave_balance(self.doc.employee, - self.doc.leave_type, self.doc.fiscal_year)["leave_balance"] + if self.doc.from_date and self.doc.to_date: self.doc.total_leave_days = self.get_total_leave_days()["total_leave_days"] if self.doc.total_leave_days == 0: @@ -113,9 +111,13 @@ class DocType(DocListController): coincide with holiday(s). You need not apply for leave."), raise_exception=1) - if self.doc.leave_balance - self.doc.total_leave_days < 0: - msgprint("There is not enough leave balance for Leave Type: %s" % \ - (self.doc.leave_type,), raise_exception=1) + if not is_lwp(self.doc.leave_type): + self.doc.leave_balance = get_leave_balance(self.doc.employee, + self.doc.leave_type, self.doc.fiscal_year)["leave_balance"] + + if self.doc.leave_balance - self.doc.total_leave_days < 0: + msgprint("There is not enough leave balance for Leave Type: %s" % \ + (self.doc.leave_type,), raise_exception=1) def validate_leave_overlap(self): for d in webnotes.conn.sql("""select name, leave_type, posting_date, @@ -221,9 +223,22 @@ def get_events(start, end): events = [] employee = webnotes.conn.get_default("employee", webnotes.session.user) company = webnotes.conn.get_default("company", webnotes.session.user) - - add_department_leaves(events, start, end, employee, company) + + from webnotes.widgets.reportview import build_match_conditions + match_conditions = build_match_conditions({"doctype": "Leave Application"}) + + # show department leaves for employee + show_department_leaves = match_conditions and \ + len(match_conditions.split("or"))==1 and "employee" in match_conditions + + if show_department_leaves: + add_department_leaves(events, start, end, employee, company) + else: + add_leaves(events, start, end, employee, company, match_conditions) + add_block_dates(events, start, end, employee, company) + add_holidays(events, start, end, employee, company) + return events def add_department_leaves(events, start, end, employee, company): @@ -233,28 +248,33 @@ def add_department_leaves(events, start, end, employee, company): return # department leaves - department_employees = webnotes.conn.sql_list("select name from tabEmployee where department=%s", - department) + department_employees = webnotes.conn.sql_list("""select name from tabEmployee where department=%s + and company=%s""", (department, company)) - for d in webnotes.conn.sql("""select name, from_date, to_date, employee_name, half_day, + match_conditions = "employee in (\"%s\")" % '", "'.join(department_employees) + add_leaves(events, start, end, employee, company, match_conditions=match_conditions) + +def add_leaves(events, start, end, employee, company, match_conditions=None): + query = """select name, from_date, to_date, employee_name, half_day, status, employee, docstatus from `tabLeave Application` where (from_date between %s and %s or to_date between %s and %s) and docstatus < 2 - and status!="Rejected" - and employee in ('%s')""" % ("%s", "%s", "%s", "%s", "', '".join(department_employees)), - (start, end, start, end), as_dict=True): - events.append({ - "name": d.name, - "doctype": "Leave Application", - "from_date": d.from_date, - "to_date": d.to_date, - "status": d.status, - "title": _("Leave by") + " " + cstr(d.employee_name) + \ - (d.half_day and _(" (Half Day)") or ""), - "docstatus": d.docstatus - }) + and status!="Rejected" """ + if match_conditions: + query += " and " + match_conditions + for d in webnotes.conn.sql(query, (start, end, start, end), as_dict=True): + events.append({ + "name": d.name, + "doctype": "Leave Application", + "from_date": d.from_date, + "to_date": d.to_date, + "status": d.status, + "title": _("Leave by") + " " + cstr(d.employee_name) + \ + (d.half_day and _(" (Half Day)") or ""), + "docstatus": d.docstatus + }) def add_block_dates(events, start, end, employee, company): # block days @@ -271,4 +291,18 @@ def add_block_dates(events, start, end, employee, company): "name": "_" + str(cnt), }) cnt+=1 + +def add_holidays(events, start, end, employee, company): + applicable_holiday_list = webnotes.conn.get_value("Employee", employee, "holiday_list") + if not applicable_holiday_list: + return + for holiday in webnotes.conn.sql("""select name, holiday_date, description + from `tabHoliday` where parent=%s and holiday_date between %s and %s""", + (applicable_holiday_list, start, end), as_dict=True): + events.append({ + "doctype": "Holiday", + "from_date": holiday.holiday_date, + "title": _("Holiday") + ": " + cstr(holiday.description), + "name": holiday.name + }) From 66ea0861ffbb45ae476a3f0a9303fb84150a2f0c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 Feb 2013 15:13:23 +0530 Subject: [PATCH 11/11] fixes in gle_floating_point_issue patch --- patches/february_2013/fix_outstanding.py | 33 ++++++++++++------- .../gle_floating_point_issue_revisited.py | 2 +- patches/patch_list.py | 3 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/patches/february_2013/fix_outstanding.py b/patches/february_2013/fix_outstanding.py index 07ea51a695c..22a6ee17400 100644 --- a/patches/february_2013/fix_outstanding.py +++ b/patches/february_2013/fix_outstanding.py @@ -1,15 +1,24 @@ def execute(): import webnotes from webnotes.utils import flt - for dt in ["Sales Invoice", "Purchase Invoice"]: - records = webnotes.conn.sql("""select name, outstanding_amount from `tab%s` - where docstatus = 1""" % dt) - for r in records: - outstanding = webnotes.conn.sql(""" - select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) from `tabGL Entry` - where against_voucher = %s and against_voucher_type = %s - and ifnull(is_cancelled, 'No') = 'No'""", (r[0], dt)) - if flt(r[1]) != abs(flt(outstanding[0][0])): - # print r, outstanding - webnotes.conn.sql("update `tab%s` set outstanding_amount = %s where name = %s" % - (dt, '%s', '%s'), (abs(flt(outstanding[0][0])), r[0])) \ No newline at end of file + records = webnotes.conn.sql(""" + select against_voucher_type, against_voucher, + sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) as outstanding from `tabGL Entry` + where ifnull(is_cancelled, 'No') = 'No' + and against_voucher_type in ("Sales Invoice", "Purchase Invoice") + and ifnull(against_voucher, '') != '' + group by against_voucher_type, against_voucher""", as_dict=1) + for r in records: + outstanding = webnotes.conn.sql("""select name, outstanding_amount from `tab%s` + where name = %s and docstatus = 1""" % + (r["against_voucher_type"], '%s'), (r["against_voucher"])) + + if outstanding and abs(flt(r["outstanding"])) != flt(outstanding[0][1]): + if ((r["against_voucher_type"]=='Sales Invoice' and flt(r["outstanding"]) >= 0) \ + or (r["against_voucher_type"]=="Purchase Invoice" and flt(["outstanding"]) <= 0)): + webnotes.conn.set_value(r["against_voucher_type"], r["against_voucher"], + "outstanding_amount", abs(flt(r["outstanding"]))) + else: + print r["against_voucher_type"], r["against_voucher"], \ + outstanding[0][1], abs(flt(r["outstanding"])) + \ No newline at end of file diff --git a/patches/february_2013/gle_floating_point_issue_revisited.py b/patches/february_2013/gle_floating_point_issue_revisited.py index 3fc57bd4e59..e407d5080ea 100644 --- a/patches/february_2013/gle_floating_point_issue_revisited.py +++ b/patches/february_2013/gle_floating_point_issue_revisited.py @@ -13,7 +13,7 @@ def execute(): diff = round((flt(r.grand_total) - flt(gle[0]['debit'])), 2) if abs(diff) == 0.01: - # print r.name, r.grand_total, gle[0]['debit'] + # print r.name, r.grand_total, gle[0]['debit'], diff webnotes.conn.sql("""update `tabGL Entry` set debit = debit + %s where name = %s""", (diff, gle[0]['name'])) diff --git a/patches/patch_list.py b/patches/patch_list.py index 6f21d5df85a..d42360ef067 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -169,9 +169,10 @@ patch_list = [ "patches.february_2013.update_company_in_leave_application", "execute:webnotes.conn.sql_ddl('alter table tabSeries change `name` `name` varchar(100)')", "execute:webnotes.conn.sql('update tabUserRole set parentfield=\"user_roles\" where parentfield=\"userroles\"')", - "patches.february_2013.fix_outstanding", "patches.february_2013.p01_event", "execute:webnotes.delete_doc('Page', 'Calendar')", "patches.february_2013.p02_email_digest", "patches.february_2013.p05_leave_application", + "patches.february_2013.gle_floating_point_issue_revisited", + "patches.february_2013.fix_outstanding", ] \ No newline at end of file