diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.txt b/accounts/doctype/purchase_invoice/purchase_invoice.txt index 43d2c790fc5..283c6123711 100755 --- a/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-04-09 10:18:10", + "creation": "2013-05-07 13:50:30", "docstatus": 0, - "modified": "2013-03-22 18:17:14", + "modified": "2013-05-13 11:12:56", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,7 +30,9 @@ "parent": "Purchase Invoice", "parentfield": "permissions", "parenttype": "DocType", - "read": 1 + "permlevel": 0, + "read": 1, + "report": 1 }, { "doctype": "DocType", @@ -41,6 +43,7 @@ "fieldname": "column_break0", "fieldtype": "Column Break", "oldfieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -54,6 +57,7 @@ "oldfieldtype": "Select", "options": "BILL\nBILLJ", "print_hide": 1, + "read_only": 0, "report_hide": 0, "reqd": 1 }, @@ -68,6 +72,7 @@ "oldfieldtype": "Link", "options": "Account", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 1 }, @@ -80,7 +85,8 @@ "oldfieldname": "supplier", "oldfieldtype": "Link", "options": "Supplier", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -131,6 +137,7 @@ "fieldname": "column_break1", "fieldtype": "Column Break", "oldfieldtype": "Column Break", + "read_only": 0, "reqd": 0, "width": "50%" }, @@ -146,6 +153,7 @@ "oldfieldname": "posting_date", "oldfieldtype": "Date", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 1 }, @@ -159,6 +167,7 @@ "oldfieldname": "bill_no", "oldfieldtype": "Data", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 1 }, @@ -171,6 +180,7 @@ "oldfieldname": "bill_date", "oldfieldtype": "Date", "print_hide": 1, + "read_only": 0, "reqd": 0, "search_index": 1 }, @@ -179,7 +189,8 @@ "fieldname": "items", "fieldtype": "Section Break", "label": "Items", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "allow_on_submit": 1, @@ -189,25 +200,29 @@ "label": "Entries", "oldfieldname": "entries", "oldfieldtype": "Table", - "options": "Purchase Invoice Item" + "options": "Purchase Invoice Item", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break0", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "recalculate", "fieldtype": "Button", "label": "Recalculate", - "oldfieldtype": "Button" + "oldfieldtype": "Button", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break_17", "fieldtype": "Section Break", - "options": "Simple" + "options": "Simple", + "read_only": 0 }, { "description": "Select Items from Purchase Order", @@ -218,7 +233,8 @@ "oldfieldname": "purchase_order_main", "oldfieldtype": "Link", "options": "Purchase Order", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "description": "Select Items from Purchase Receipt", @@ -229,7 +245,8 @@ "oldfieldname": "purchase_receipt_main", "oldfieldtype": "Link", "options": "Purchase Receipt", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -237,13 +254,15 @@ "fieldtype": "Button", "label": "Get Items", "oldfieldtype": "Button", - "options": "pull_details" + "options": "pull_details", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "currency_price_list", "fieldtype": "Section Break", - "label": "Currency & Price List" + "label": "Currency & Price List", + "read_only": 0 }, { "doctype": "DocField", @@ -253,7 +272,8 @@ "oldfieldname": "currency", "oldfieldtype": "Select", "options": "Currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "default": "1", @@ -264,12 +284,14 @@ "label": "Exchange Rate", "oldfieldname": "conversion_rate", "oldfieldtype": "Currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break2", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "read_only": 0 }, { "description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)", @@ -278,7 +300,8 @@ "fieldtype": "Link", "label": "Price List", "options": "Price List", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "price_list_name", @@ -287,7 +310,8 @@ "fieldtype": "Link", "label": "Price List Currency", "options": "Currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "price_list_name", @@ -295,7 +319,8 @@ "fieldname": "plc_conversion_rate", "fieldtype": "Float", "label": "Price List Exchange Rate", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "description": "Add / Edit Taxes and Charges", @@ -303,7 +328,8 @@ "fieldname": "taxes", "fieldtype": "Section Break", "label": "Taxes", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "doctype": "DocField", @@ -313,7 +339,8 @@ "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", "options": "Purchase Taxes and Charges Master", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -322,7 +349,8 @@ "label": "Get Tax Detail", "oldfieldtype": "Button", "options": "get_purchase_tax_details", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -331,7 +359,8 @@ "label": "Purchase Taxes and Charges", "oldfieldname": "purchase_tax_details", "oldfieldtype": "Table", - "options": "Purchase Taxes and Charges" + "options": "Purchase Taxes and Charges", + "read_only": 0 }, { "doctype": "DocField", @@ -339,7 +368,8 @@ "fieldtype": "Button", "label": "Calculate Tax", "oldfieldtype": "Button", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -347,7 +377,8 @@ "fieldtype": "HTML", "label": "Tax Calculation", "oldfieldtype": "HTML", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -364,7 +395,8 @@ "doctype": "DocField", "fieldname": "contact_section", "fieldtype": "Section Break", - "label": "Contact Info" + "label": "Contact Info", + "read_only": 0 }, { "depends_on": "eval:doc.supplier", @@ -372,12 +404,14 @@ "fieldname": "supplier_address", "fieldtype": "Link", "label": "Supplier Address", - "options": "Address" + "options": "Address", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "col_break23", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -387,14 +421,16 @@ "fieldtype": "Link", "label": "Contact Person", "options": "Contact", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "totals", "fieldtype": "Section Break", "label": "Totals", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "doctype": "DocField", @@ -497,6 +533,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -562,7 +599,8 @@ "label": "Write Off Amount", "no_copy": 1, "options": "Company:company:default_currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "eval:flt(doc.write_off_amount)!=0", @@ -572,7 +610,8 @@ "label": "Write Off Account", "no_copy": 1, "options": "Account", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "eval:flt(doc.write_off_amount)!=0", @@ -581,8 +620,9 @@ "fieldtype": "Link", "label": "Write Off Cost Center", "no_copy": 1, - "options": "Account", - "print_hide": 1 + "options": "Cost Center", + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -594,6 +634,7 @@ "oldfieldname": "against_expense_account", "oldfieldtype": "Small Text", "print_hide": 1, + "read_only": 0, "report_hide": 0 }, { @@ -602,7 +643,8 @@ "fieldtype": "Section Break", "label": "Advances", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -611,7 +653,8 @@ "label": "Get Advances Paid", "oldfieldtype": "Button", "options": "get_advances", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -622,7 +665,8 @@ "oldfieldname": "advance_allocation_details", "oldfieldtype": "Table", "options": "Purchase Invoice Advance", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -630,7 +674,8 @@ "fieldtype": "Section Break", "label": "More Info", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "default": "No", @@ -644,6 +689,7 @@ "oldfieldtype": "Select", "options": "No\nYes", "print_hide": 1, + "read_only": 0, "search_index": 1 }, { @@ -655,6 +701,7 @@ "oldfieldname": "aging_date", "oldfieldtype": "Date", "print_hide": 1, + "read_only": 0, "search_index": 0 }, { @@ -680,6 +727,7 @@ "oldfieldtype": "Link", "options": "Print Heading", "print_hide": 1, + "read_only": 0, "report_hide": 1 }, { @@ -692,6 +740,7 @@ "oldfieldname": "due_date", "oldfieldtype": "Date", "print_hide": 0, + "read_only": 0, "search_index": 1 }, { @@ -701,12 +750,14 @@ "label": "Mode of Payment", "oldfieldname": "mode_of_payment", "oldfieldtype": "Select", - "options": "link:Mode of Payment" + "options": "link:Mode of Payment", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break_63", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "read_only": 0 }, { "doctype": "DocField", @@ -718,6 +769,7 @@ "oldfieldtype": "Link", "options": "Company", "print_hide": 1, + "read_only": 0, "search_index": 1 }, { @@ -730,6 +782,7 @@ "oldfieldtype": "Select", "options": "link:Fiscal Year", "print_hide": 1, + "read_only": 0, "search_index": 1 }, { @@ -753,81 +806,53 @@ "oldfieldname": "remarks", "oldfieldtype": "Text", "print_hide": 1, + "read_only": 0, "reqd": 0 }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "match": "", - "permlevel": 1, - "report": 0, - "role": "Accounts Manager", - "submit": 0, - "write": 0 - }, { "amend": 1, "cancel": 1, "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "Accounts Manager", - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "match": "", - "permlevel": 1, - "report": 0, - "role": "Accounts User", - "submit": 0, - "write": 0 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "match": "", - "permlevel": 1, - "role": "Purchase User", - "submit": 0 - }, - { - "amend": 0, - "cancel": 0, - "create": 1, - "doctype": "DocPerm", - "match": "", - "permlevel": 0, - "report": 1, - "role": "Purchase User", - "submit": 0, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, "role": "Accounts User", "submit": 1, "write": 1 }, { + "amend": 0, + "cancel": 0, + "create": 1, + "doctype": "DocPerm", + "role": "Purchase User", + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, "doctype": "DocPerm", "match": "supplier", - "permlevel": 0, - "report": 1, - "role": "Supplier" + "role": "Supplier", + "submit": 0, + "write": 0 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "role": "Accounts Manager", + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "role": "Auditor", + "submit": 0, + "write": 0 } ] \ No newline at end of file diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py index b15097457d6..3946f0033d7 100644 --- a/accounts/report/sales_register/sales_register.py +++ b/accounts/report/sales_register/sales_register.py @@ -36,7 +36,7 @@ def execute(filters=None): # invoice details sales_order = ", ".join(invoice_so_dn_map.get(inv.name, {}).get("sales_order", [])) delivery_note = ", ".join(invoice_so_dn_map.get(inv.name, {}).get("delivery_note", [])) - # webnotes.errprint(customer_map.get(inv.customer, [])) + row = [inv.name, inv.posting_date, inv.customer, inv.debit_to, account_map.get(inv.debit_to), customer_map.get(inv.customer), inv.project_name, inv.remarks, sales_order, delivery_note] diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js index e7532dda2ea..2070fd4e338 100644 --- a/buying/page/buying_home/buying_home.js +++ b/buying/page/buying_home/buying_home.js @@ -111,6 +111,10 @@ wn.module_page["Buying"] = [ "label":wn._("Purchase In Transit"), route: "query-report/Purchase In Transit", }, + { + "label":wn._("Requested Items To Be Ordered"), + route: "query-report/Requested Items To Be Ordered", + }, ] } ] diff --git a/buying/report/requested_items_to_be_ordered/__init__.py b/buying/report/requested_items_to_be_ordered/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt new file mode 100644 index 00000000000..49c747854aa --- /dev/null +++ b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt @@ -0,0 +1,23 @@ +[ + { + "creation": "2013-05-13 16:10:02", + "docstatus": 0, + "modified": "2013-05-13 16:21:07", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "add_total_row": 1, + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Ordered Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc", + "ref_doctype": "Purchase Order", + "report_name": "Requested Items To Be Ordered", + "report_type": "Query Report" + }, + { + "doctype": "Report", + "name": "Requested Items To Be Ordered" + } +] \ No newline at end of file diff --git a/config.json b/config.json index ff6f80ffff1..cb1a83164bd 100644 --- a/config.json +++ b/config.json @@ -114,7 +114,7 @@ "ticket": { "no_cache": true, "template": "app/website/templates/pages/ticket", - "get_website_args": "support.doctype.support_ticket.support_ticket.get_website_args" + "args_method": "support.doctype.support_ticket.support_ticket.get_website_args" }, "tickets": { "template": "app/website/templates/pages/tickets" @@ -122,6 +122,10 @@ "writers": { "template": "app/website/templates/pages/writers", "args_method": "website.helpers.blog.get_writers_args" + }, + "profile": { + "no_cache": true, + "template": "app/website/templates/pages/profile" } }, "generators": { diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py index 9a9ed136afc..036980326cf 100644 --- a/hr/doctype/employee/employee.py +++ b/hr/doctype/employee/employee.py @@ -80,7 +80,7 @@ class DocType: if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole where parent=%s""", self.doc.user_id): from webnotes.profile import add_role - add_role(self.doc.user_id, "HR User") + add_role(self.doc.user_id, "Employee") profile_wrapper = webnotes.bean("Profile", self.doc.user_id) diff --git a/hr/doctype/upload_attendance/upload_attendance.js b/hr/doctype/upload_attendance/upload_attendance.js index 35a00ed69dc..4e5b47fe00f 100644 --- a/hr/doctype/upload_attendance/upload_attendance.js +++ b/hr/doctype/upload_attendance/upload_attendance.js @@ -75,7 +75,6 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({ r.messages = ["

Import Successful!

"]. concat(r.messages) } - console.log(r.messages); $.each(r.messages, function(i, v) { var $p = $('

').html(v).appendTo($log_wrapper); diff --git a/hr/doctype/upload_attendance/upload_attendance.py b/hr/doctype/upload_attendance/upload_attendance.py index e48cbefb69e..ee4234a2791 100644 --- a/hr/doctype/upload_attendance/upload_attendance.py +++ b/hr/doctype/upload_attendance/upload_attendance.py @@ -100,7 +100,6 @@ def get_naming_series(): def upload(): from webnotes.utils.datautils import read_csv_content_from_uploaded_file from webnotes.modules import scrub - from core.page.data_import_tool.data_import_tool import check_record, import_doc rows = read_csv_content_from_uploaded_file() if not rows: @@ -112,6 +111,9 @@ def upload(): ret = [] error = False + from webnotes.utils.datautils import check_record, import_doc + doctype_dl = webnotes.get_doctype("Attendance") + for i, row in enumerate(rows[5:]): if not row: continue row_idx = i + 5 @@ -121,7 +123,7 @@ def upload(): d["docstatus"] = webnotes.conn.get_value("Attendance", d.name, "docstatus") try: - check_record(d) + check_record(d, doctype_dl=doctype_dl) ret.append(import_doc(d, "Attendance", 1, row_idx, submit=True)) except Exception, e: error = True diff --git a/hr/page/hr_home/hr_home.js b/hr/page/hr_home/hr_home.js index b2cce73f15e..e35a80849b9 100644 --- a/hr/page/hr_home/hr_home.js +++ b/hr/page/hr_home/hr_home.js @@ -177,6 +177,14 @@ wn.module_page["HR"] = [ "label":wn._("Employee Information"), route: "Report2/Employee/Employee Information" }, + { + "label":wn._("Monthly Salary Register"), + route: "query-report/Monthly Salary Register" + }, + { + "label":wn._("Monthly Attendance Sheet"), + route: "query-report/Monthly Attendance Sheet" + }, ] } ]; diff --git a/hr/report/monthly_attendance_sheet/__init__.py b/hr/report/monthly_attendance_sheet/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js new file mode 100644 index 00000000000..6dc8d78ea5e --- /dev/null +++ b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js @@ -0,0 +1,32 @@ +wn.query_reports["Monthly Attendance Sheet"] = { + "filters": [ + { + "fieldname":"month", + "label": "Month", + "fieldtype": "Select", + "options": "Jan\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()], + }, + { + "fieldname":"fiscal_year", + "label": "Fiscal Year", + "fieldtype": "Link", + "options": "Fiscal Year", + "default": sys_defaults.fiscal_year, + }, + { + "fieldname":"employee", + "label": "Employee", + "fieldtype": "Link", + "options": "Employee" + }, + { + "fieldname":"company", + "label": "Company", + "fieldtype": "Link", + "options": "Company", + "default": sys_defaults.company + } + ] +} \ No newline at end of file diff --git a/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py new file mode 100644 index 00000000000..42a977025a6 --- /dev/null +++ b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -0,0 +1,107 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals +import webnotes +from webnotes.utils import cstr, cint +from webnotes import msgprint, _ + +def execute(filters=None): + if not filters: filters = {} + + conditions, filters = get_conditions(filters) + columns = get_columns(filters) + att_map = get_attendance_list(conditions, filters) + emp_map = get_employee_details() + + data = [] + for emp in sorted(att_map): + emp_det = emp_map.get(emp) + row = [emp, emp_det.employee_name, emp_det.branch, emp_det.department, emp_det.designation, + emp_det.company] + + total_p = total_a = 0.0 + for day in range(filters["total_days_in_month"]): + status = att_map.get(emp).get(day + 1, "Absent") + status_map = {"Present": "P", "Absent": "A", "Half Day": "HD"} + row.append(status_map[status]) + + if status == "Present": + total_p += 1 + elif status == "Absent": + total_a += 1 + elif status == "Half Day": + total_p += 0.5 + total_a += 0.5 + + row += [total_p, total_a] + + data.append(row) + + return columns, data + +def get_columns(filters): + columns = [ + "Employee:Link/Employee:120", "Employee Name::140", "Branch:Link/Branch:120", + "Department:Link/Department:120", "Designation:Link/Designation:120", + "Company:Link/Company:120" + ] + + for day in range(filters["total_days_in_month"]): + columns.append(cstr(day+1) +"::20") + + columns += ["Total Present:Float:80", "Total Absent:Float:80"] + return columns + +def get_attendance_list(conditions, filters): + attendance_list = webnotes.conn.sql("""select employee, day(att_date) as day_of_month, + status from tabAttendance where docstatus = 1 %s order by employee, att_date""" % + conditions, filters, as_dict=1) + + att_map = {} + for d in attendance_list: + att_map.setdefault(d.employee, webnotes._dict()).setdefault(d.day_of_month, "") + att_map[d.employee][d.day_of_month] = d.status + + return att_map + +def get_conditions(filters): + if not (filters.get("month") and filters.get("fiscal_year")): + msgprint(_("Please select month and year"), raise_exception=1) + + filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", + "Dec"].index(filters["month"]) + 1 + + from calendar import monthrange + filters["total_days_in_month"] = monthrange(cint(filters["fiscal_year"].split("-")[-1]), + filters["month"])[1] + + conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s" + + if filters.get("company"): conditions += " and company = %(company)s" + if filters.get("employee"): conditions += " and employee = %(employee)s" + + return conditions, filters + +def get_employee_details(): + employee = webnotes.conn.sql("""select name, employee_name, designation, department, + branch, company from tabEmployee where docstatus < 2 and status = 'Active'""", as_dict=1) + + emp_map = {} + for emp in employee: + emp_map[emp.name] = emp + + return emp_map \ No newline at end of file diff --git a/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.txt b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.txt new file mode 100644 index 00000000000..3c53aae8e46 --- /dev/null +++ b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.txt @@ -0,0 +1,22 @@ +[ + { + "creation": "2013-05-13 14:04:03", + "docstatus": 0, + "modified": "2013-05-13 14:32:42", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "add_total_row": 0, + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Attendance", + "report_name": "Monthly Attendance Sheet", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Monthly Attendance Sheet" + } +] \ No newline at end of file diff --git a/hr/report/monthly_salary_register/__init__.py b/hr/report/monthly_salary_register/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/hr/report/monthly_salary_register/monthly_salary_register.js b/hr/report/monthly_salary_register/monthly_salary_register.js new file mode 100644 index 00000000000..da881378ff0 --- /dev/null +++ b/hr/report/monthly_salary_register/monthly_salary_register.js @@ -0,0 +1,32 @@ +wn.query_reports["Monthly Salary Register"] = { + "filters": [ + { + "fieldname":"month", + "label": "Month", + "fieldtype": "Select", + "options": "Jan\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()], + }, + { + "fieldname":"fiscal_year", + "label": "Fiscal Year", + "fieldtype": "Link", + "options": "Fiscal Year", + "default": sys_defaults.fiscal_year, + }, + { + "fieldname":"employee", + "label": "Employee", + "fieldtype": "Link", + "options": "Employee" + }, + { + "fieldname":"company", + "label": "Company", + "fieldtype": "Link", + "options": "Company", + "default": sys_defaults.company + } + ] +} \ No newline at end of file diff --git a/hr/report/monthly_salary_register/monthly_salary_register.py b/hr/report/monthly_salary_register/monthly_salary_register.py new file mode 100644 index 00000000000..cc25dc3e329 --- /dev/null +++ b/hr/report/monthly_salary_register/monthly_salary_register.py @@ -0,0 +1,119 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals +import webnotes +from webnotes.utils import flt, cstr +from webnotes import msgprint, _ + +def execute(filters=None): + if not filters: filters = {} + + salary_slips = get_salary_slips(filters) + columns, earning_types, ded_types = get_columns(salary_slips) + ss_earning_map = get_ss_earning_map(salary_slips) + ss_ded_map = get_ss_ded_map(salary_slips) + + data = [] + for ss in salary_slips: + row = [ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation, + ss.company, ss.month, ss.leave_withut_pay, ss.payment_days] + + for e in earning_types: + row.append(ss_earning_map.get(ss.name, {}).get(e)) + + row += [ss.arrear_amount, ss.leave_encashment_amount, ss.gross_pay] + + for d in ded_types: + row.append(ss_ded_map.get(ss.name, {}).get(d)) + + row += [ss.total_deduction, ss.net_pay] + + data.append(row) + + return columns, data + +def get_columns(salary_slips): + columns = [ + "Employee:Link/Employee:120", "Employee Name::140", "Branch:Link/Branch:120", + "Department:Link/Department:120", "Designation:Link/Designation:120", + "Company:Link/Company:120", "Month::80", "Leave Without pay:Float:130", + "Payment Days:Float:120" + ] + + earning_types = webnotes.conn.sql_list("""select distinct e_type from `tabSalary Slip Earning` + where ifnull(e_modified_amount, 0) != 0 and parent in (%s)""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips])) + + ded_types = webnotes.conn.sql_list("""select distinct d_type from `tabSalary Slip Deduction` + where ifnull(d_modified_amount, 0) != 0 and parent in (%s)""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips])) + + columns = columns + [(e + ":Link/Earning Type:120") for e in earning_types] + \ + ["Arrear Amount:Currency:120", "Leave Encashment Amount:Currency:150", + "Gross Pay:Currency:120"] + [(d + ":Link/Deduction Type:120") for d in ded_types] + \ + ["Total Deduction:Currency:120", "Net Pay:Currency:120"] + + return columns, earning_types, ded_types + +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) + + if not salary_slips: + msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) + + _(" and year: ") + cstr(filters.get("fiscal_year")), raise_exception=1) + + return salary_slips + +def get_conditions(filters): + conditions = "" + if filters.get("month"): + month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", + "Dec"].index(filters["month"]) + 1 + filters["month"] = month + conditions += " and month = %(month)s" + + if filters.get("fiscal_year"): conditions += " and fiscal_year = %(fiscal_year)s" + if filters.get("company"): conditions += " and company = %(company)s" + if filters.get("employee"): conditions += " and employee = %(employee)s" + + return conditions, filters + +def get_ss_earning_map(salary_slips): + ss_earnings = webnotes.conn.sql("""select parent, e_type, e_modified_amount + from `tabSalary Slip Earning` where parent in (%s)""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + ss_earning_map = {} + for d in ss_earnings: + ss_earning_map.setdefault(d.parent, webnotes._dict()).setdefault(d.e_type, []) + ss_earning_map[d.parent][d.e_type] = flt(d.e_modified_amount) + + return ss_earning_map + +def get_ss_ded_map(salary_slips): + ss_deductions = webnotes.conn.sql("""select parent, d_type, d_modified_amount + from `tabSalary Slip Deduction` where parent in (%s)""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + ss_ded_map = {} + for d in ss_deductions: + ss_ded_map.setdefault(d.parent, webnotes._dict()).setdefault(d.d_type, []) + ss_ded_map[d.parent][d.e_type] = flt(d.d_modified_amount) + + return ss_ded_map \ No newline at end of file diff --git a/hr/report/monthly_salary_register/monthly_salary_register.txt b/hr/report/monthly_salary_register/monthly_salary_register.txt new file mode 100644 index 00000000000..b0d5880eaf0 --- /dev/null +++ b/hr/report/monthly_salary_register/monthly_salary_register.txt @@ -0,0 +1,22 @@ +[ + { + "creation": "2013-05-07 18:09:42", + "docstatus": 0, + "modified": "2013-05-07 18:09:42", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "add_total_row": 1, + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Salary Slip", + "report_name": "Monthly Salary Register", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Monthly Salary Register" + } +] \ No newline at end of file diff --git a/patches/may_2013/repost_stock_for_no_posting_time.py b/patches/may_2013/repost_stock_for_no_posting_time.py new file mode 100644 index 00000000000..04ceae5ecae --- /dev/null +++ b/patches/may_2013/repost_stock_for_no_posting_time.py @@ -0,0 +1,34 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals +def execute(): + import webnotes + from stock.stock_ledger import update_entries_after + + res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry` + where posting_time = '00:00'""") + + i=0 + for d in res: + try: + update_entries_after({ "item_code": d[0], "warehouse": d[1] }) + except: + pass + i += 1 + if i%100 == 0: + webnotes.conn.sql("commit") + webnotes.conn.sql("start transaction") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 0a1370e453e..f9d4d2921d4 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -251,4 +251,5 @@ patch_list = [ "patches.april_2013.rebuild_sales_browser", "patches.april_2013.p08_price_list_country", "patches.may_2013.p01_selling_net_total_export", + "patches.may_2013.repost_stock_for_no_posting_time", ] \ No newline at end of file diff --git a/projects/utils.py b/projects/utils.py index 70f6995bf5b..e37a21c2c49 100644 --- a/projects/utils.py +++ b/projects/utils.py @@ -9,15 +9,21 @@ def get_time_log_list(doctype, txt, searchfield, start, page_len, filters): @webnotes.whitelist() def query_task(doctype, txt, searchfield, start, page_len, filters): + from webnotes.widgets.reportview import build_match_conditions + search_string = "%%%s%%" % txt order_by_string = "%s%%" % txt + match_conditions = build_match_conditions("Task") + match_conditions = ("and" + match_conditions) if match_conditions else "" + return webnotes.conn.sql("""select name, subject from `tabTask` - where `%s` like %s or `subject` like %s + where (`%s` like %s or `subject` like %s) %s order by case when `subject` like %s then 0 else 1 end, case when `%s` like %s then 0 else 1 end, `%s`, subject limit %s, %s""" % - (searchfield, "%s", "%s", "%s", searchfield, "%s", searchfield, "%s", "%s"), + (searchfield, "%s", "%s", match_conditions, "%s", + searchfield, "%s", searchfield, "%s", "%s"), (search_string, search_string, order_by_string, order_by_string, start, page_len)) \ No newline at end of file diff --git a/setup/page/setup/setup.js b/setup/page/setup/setup.js index b47f6f28d11..1ebd7307a68 100644 --- a/setup/page/setup/setup.js +++ b/setup/page/setup/setup.js @@ -193,21 +193,8 @@ wn.module_page["Setup"] = [ ] }, { - title: wn._("Backups"), - icon: "icon-cloud-upload", - right: true, - items: [ - { - "route":"Form/Backup Manager", - doctype:"Backup Manager", - label: wn._("Backup Manager"), - "description":wn._("Sync backups with remote tools like Dropbox etc.") - }, - ] - }, - { - title: wn._("Update Manager"), - icon: "icon-magnet", + title: wn._("Administration"), + icon: "icon-rocket", right: true, items: [ { @@ -215,6 +202,18 @@ wn.module_page["Setup"] = [ label: wn._("Update This Application"), "description":wn._("Apply latest updates and patches to this app") }, + { + "route":"Form/Backup Manager", + doctype:"Backup Manager", + label: wn._("Backup Manager"), + "description":wn._("Sync backups with remote tools like Dropbox etc.") + }, + { + "route":"List/Scheduler Log", + doctype:"Scheduler Log", + label: wn._("Scheduler Error Log"), + "description":wn._("Get a list of errors encountered by the Scheduler") + }, ] }, ] diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js index bfcaf8acc14..75e4ee15b02 100644 --- a/stock/page/stock_home/stock_home.js +++ b/stock/page/stock_home/stock_home.js @@ -201,6 +201,10 @@ wn.module_page["Stock"] = [ "label":wn._("Purchase In Transit"), route: "query-report/Purchase In Transit", }, + { + "label":wn._("Requested Items To Be Transferred"), + route: "query-report/Requested Items To Be Transferred", + }, ] } ] diff --git a/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt b/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt index 45e3a42dee1..7a2f6365bf0 100644 --- a/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt +++ b/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt @@ -1,16 +1,17 @@ [ { - "creation": "2013-02-21 14:26:49", + "creation": "2013-02-22 18:01:55", "docstatus": 0, - "modified": "2013-02-22 15:53:01", + "modified": "2013-05-13 16:11:27", "modified_by": "Administrator", "owner": "Administrator" }, { + "add_total_row": 1, "doctype": "Report", "is_standard": "Yes", "name": "__common__", - "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n `tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n `tabPurchase Order`.`project_name` as \"Project\",\n `tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n `tabPurchase Order Item`.qty as \"Qty:Float:100\",\n `tabPurchase Order Item`.received_qty as \"Received Qty:Float:100\", \n (`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) as \"Qty to Receive:Float:100\",\n `tabPurchase Order Item`.item_name as \"Item Name::150\",\n `tabPurchase Order Item`.description as \"Description::200\"\nfrom\n `tabPurchase Order`, `tabPurchase Order Item`\nwhere\n `tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n and `tabPurchase Order`.docstatus = 1\n and `tabPurchase Order`.status != \"Stopped\"\n and ifnull(`tabPurchase Order Item`.received_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc", + "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n\t`tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.qty as \"Qty:Float:100\",\n\t`tabPurchase Order Item`.received_qty as \"Received Qty:Float:100\", \n\t(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) as \"Qty to Receive:Float:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.received_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc", "ref_doctype": "Purchase Receipt", "report_name": "Purchase Order Items To Be Received", "report_type": "Query Report" diff --git a/stock/report/requested_items_to_be_transferred/__init__.py b/stock/report/requested_items_to_be_transferred/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.txt b/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.txt new file mode 100644 index 00000000000..030ed242d80 --- /dev/null +++ b/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.txt @@ -0,0 +1,23 @@ +[ + { + "creation": "2013-05-13 16:23:05", + "docstatus": 0, + "modified": "2013-05-13 16:25:08", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "add_total_row": 1, + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Transferred Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Transfer:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Transfer\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc", + "ref_doctype": "Stock Entry", + "report_name": "Requested Items To Be Transferred", + "report_type": "Query Report" + }, + { + "doctype": "Report", + "name": "Requested Items To Be Transferred" + } +] \ No newline at end of file diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index 8a705f41c72..ca46a8e073c 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -86,7 +86,7 @@ def get_tickets(): webnotes.session.user, as_dict=1) return tickets -def get_website_args(): +def get_website_args(): bean = webnotes.bean("Support Ticket", webnotes.form_dict.name) if bean.doc.raised_by != webnotes.session.user: return { diff --git a/website/helpers/product.py b/website/helpers/product.py index d6f16fb7530..a107d9b02ba 100644 --- a/website/helpers/product.py +++ b/website/helpers/product.py @@ -4,10 +4,9 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import cstr +from webnotes.utils import cstr, cint from webnotes.webutils import build_html, delete_page_cache - @webnotes.whitelist(allow_guest=True) def get_product_info(item_code): """get product price / stock info""" @@ -20,10 +19,20 @@ def get_product_info(item_code): in_stock = in_stock[0][0] > 0 and 1 or 0 else: in_stock = -1 + + price = price_list and webnotes.conn.sql("""select ref_rate, ref_currency from + `tabItem Price` where parent=%s and price_list_name=%s""", + (item_code, price_list), as_dict=1) or [] + + price = price and price[0] or None + + if price: + price["ref_currency"] = not cint(webnotes.conn.get_default("hide_currency_symbol")) \ + and (webnotes.conn.get_value("Currency", price.ref_currency, "symbol") or price.ref_currency) \ + or "" + return { - "price": price_list and webnotes.conn.sql("""select ref_rate, ref_currency from - `tabItem Price` where parent=%s and price_list_name=%s""", - (item_code, price_list), as_dict=1) or [], + "price": price, "stock": in_stock } diff --git a/website/templates/css/product_page.css b/website/templates/css/product_page.css index 566b6b57aab..71be9ee56b0 100644 --- a/website/templates/css/product_page.css +++ b/website/templates/css/product_page.css @@ -7,4 +7,7 @@ font-size: 18px; line-height: 200%; } + .item-price { + margin-top: 20px; + } \ No newline at end of file diff --git a/website/templates/html/product_page.html b/website/templates/html/product_page.html index 23091ad435b..3fda8cd271c 100644 --- a/website/templates/html/product_page.html +++ b/website/templates/html/product_page.html @@ -35,23 +35,25 @@ {{ web_long_description or web_short_description or "[No description given]" }} - {% if obj.doclist.get({"doctype":"Item Website Specification"}) %} +

+
+ + + {% if obj.doclist.get({"doctype":"Item Website Specification"}) -%} +
+

Specifications

{% for d in obj.doclist.get( - {"doctype":"Item Website Specification"}) %} + {"doctype":"Item Website Specification"}) -%} - {% endfor %} + {%- endfor %}
{{ d.label }} {{ d.description }}
- {% endif %} -
-

Price:

-
-
+ {%- endif %} {% endblock %} \ No newline at end of file diff --git a/website/templates/js/product_page.js b/website/templates/js/product_page.js index 653cfa32390..69e9cd52feb 100644 --- a/website/templates/js/product_page.js +++ b/website/templates/js/product_page.js @@ -26,8 +26,8 @@ $(document).ready(function() { success: function(data) { if(data.message) { if(data.message.price) { - $("

").html(data.message.price[0].ref_currency + " " - + data.message.price[0].ref_rate).appendTo(".item-price"); + $("

").html(data.message.price.ref_currency + " " + + data.message.price.ref_rate).appendTo(".item-price"); $(".item-price").toggle(true); } if(data.message.stock==0) {