From cc8fb1a8d62cf2165491f579ec4f35173151aae7 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Thu, 28 Jul 2016 19:50:15 +0530 Subject: [PATCH 1/6] changed path to login frappe.templates.pages.login.login_via_google changed to frappe.www.login.login_via_google --- .../docs/user/manual/en/website/setup/social-login-keys.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/docs/user/manual/en/website/setup/social-login-keys.md b/erpnext/docs/user/manual/en/website/setup/social-login-keys.md index b8784a3c4d..bb1329f3e3 100644 --- a/erpnext/docs/user/manual/en/website/setup/social-login-keys.md +++ b/erpnext/docs/user/manual/en/website/setup/social-login-keys.md @@ -5,7 +5,9 @@ Social Login enables users to login to ERPNext via their Google, Facebook or Git Checkout the following Video Tutorials to understand how to enable social logins on ERPNext * for FaceBook - https://www.youtube.com/watch?v=zC6Q6gIfiw8 -* for Google - https://www.youtube.com/watch?v=w_EAttrE9sw +* for Google - https://www.youtube.com/watch?v=w_EAttrE9sw * for GitHub - https://www.youtube.com/watch?v=bG71DxxkVjQ -{next} \ No newline at end of file +For Google the *Authorized redirect URI* is [yoursite]/api/method/frappe.www.login.login_via_google + +{next} From db0e57cdcef2bd16ebdb847e1df67af3e24cee13 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Fri, 29 Jul 2016 15:59:39 +0530 Subject: [PATCH 2/6] Demo data for Leave Allocation, Leave Application and Attendance --- erpnext/demo/setup_data.py | 21 ++++++++++++++ erpnext/demo/user/hr.py | 57 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py index 336752723e..cb33cb1542 100644 --- a/erpnext/demo/setup_data.py +++ b/erpnext/demo/setup_data.py @@ -32,6 +32,7 @@ def setup_data(): setup_employee() setup_salary_structure() setup_salary_structure_for_timesheet() + setup_leave_allocation() setup_mode_of_payment() setup_account_to_expense_type() setup_user_roles() @@ -430,3 +431,23 @@ def setup_pos_profile(): }) pos.insert() + +def setup_leave_allocation(): + year = now_datetime().year + for employee in frappe.get_all('Employee', fields=['name']): + leave_types = frappe.get_all("Leave Type", fields=['name', 'max_days_allowed']) + for leave_type in leave_types: + if not leave_type.max_days_allowed: + leave_type.max_days_allowed = 10 + + leave_allocation = frappe.get_doc({ + "doctype": "Leave Allocation", + "employee": employee.name, + "from_date": "{0}-01-01".format(year), + "to_date": "{0}-12-31".format(year), + "leave_type": leave_type.name, + "new_leaves_allocated": random.randint(1, int(leave_type.max_days_allowed)) + }) + leave_allocation.insert() + leave_allocation.submit() + frappe.db.commit() diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py index 28966ecd4a..3d5ac83b91 100644 --- a/erpnext/demo/user/hr.py +++ b/erpnext/demo/user/hr.py @@ -1,15 +1,19 @@ from __future__ import unicode_literals import frappe import random -from frappe.utils import random_string +from frappe.utils import random_string, add_days from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice from frappe.utils.make_random import how_many, get_random from erpnext.hr.doctype.expense_claim.expense_claim import get_expense_approver, make_bank_entry +from erpnext.hr.doctype.leave_application.leave_application import get_leave_balance_on, OverlapError def work(): frappe.set_user(frappe.db.get_global('demo_hr_user')) year, month = frappe.flags.current_date.strftime("%Y-%m").split("-") + + mark_attendance() + make_leave_application() # process payroll if not frappe.db.get_value("Salary Slip", {"month": month, "fiscal_year": year}): @@ -123,4 +127,53 @@ def make_sales_invoice_for_timesheet(name): sales_invoice.calculate_taxes_and_totals() sales_invoice.insert() sales_invoice.submit() - frappe.db.commit() \ No newline at end of file + frappe.db.commit() + +def make_leave_application(): + allocated_leaves = frappe.get_all("Leave Allocation", fields=['employee', 'leave_type']) + + for allocated_leave in allocated_leaves: + leave_balance = get_leave_balance_on(allocated_leave.employee, allocated_leave.leave_type, frappe.flags.current_date, + consider_all_leaves_in_the_allocation_period=True) + if leave_balance != 0: + if leave_balance == 1: + to_date = frappe.flags.current_date + else: + to_date = add_days(frappe.flags.current_date, random.randint(0, leave_balance-1)) + + leave_application = frappe.get_doc({ + "doctype": "Leave Application", + "employee": allocated_leave.employee, + "from_date": frappe.flags.current_date, + "to_date": to_date, + "leave_type": allocated_leave.leave_type, + "status": "Approved" + }) + try: + leave_application.insert() + leave_application.submit() + frappe.db.commit() + except (OverlapError): + frappe.db.rollback() + +def mark_attendance(): + att_date = frappe.flags.current_date + for employee in frappe.get_all('Employee', fields=['name'], filters = {'status': 'Active'}): + + if not frappe.db.get_value("Attendance", {"employee": employee.name, "att_date": att_date}): + attendance = frappe.get_doc({ + "doctype": "Attendance", + "employee": employee.name, + "att_date": att_date + }) + leave = frappe.db.sql("""select name from `tabLeave Application` + where employee = %s and %s between from_date and to_date and status = 'Approved' + and docstatus = 1""", (employee.name, att_date)) + + if leave: + attendance.status = "Absent" + else: + attendance.status = "Present" + attendance.save() + attendance.submit() + frappe.db.commit() \ No newline at end of file From 180e43585f3cf5c0a0d36a945f77dcfe0f55fa85 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 26 Jul 2016 17:57:42 +0530 Subject: [PATCH 3/6] [minor] formatter for item and employee --- erpnext/public/js/utils.js | 16 ++++++++++++++++ erpnext/stock/doctype/item/item.py | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 4081ca2be5..6c5f59a27d 100644 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -179,6 +179,22 @@ erpnext.utils.map_current_doc = function(opts) { } } +frappe.form.link_formatters['Item'] = function(value, doc) { + if(doc.item_name && doc.item_name !== value) { + return value + ': ' + doc.item_name; + } else { + return value; + } +} + +frappe.form.link_formatters['Employee'] = function(value, doc) { + if(doc.employee_name && doc.employee_name !== value) { + return value + ': ' + doc.employee_name; + } else { + return value; + } +} + // add description on posting time $(document).on('app_ready', function() { if(!frappe.datetime.is_timezone_same()) { diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index cedfb24d7a..b546df4126 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -120,7 +120,10 @@ class Item(WebsiteGenerator): '''set opening stock''' if not self.is_stock_item or self.has_serial_no or self.has_batch_no: return - + + if not self.valuation_rate and self.standard_rate: + self.valuation_rate = self.standard_rate + if not self.valuation_rate: frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered")) From 26005c25b2436a86cb8fe218b284c056a3db5c55 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 28 Jul 2016 15:36:11 +0530 Subject: [PATCH 4/6] [minor] fix filter for item-code --- erpnext/portal/doctype/homepage/homepage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/portal/doctype/homepage/homepage.js b/erpnext/portal/doctype/homepage/homepage.js index df7f5ce6ae..100074f07d 100644 --- a/erpnext/portal/doctype/homepage/homepage.js +++ b/erpnext/portal/doctype/homepage/homepage.js @@ -15,7 +15,7 @@ frappe.ui.form.on('Homepage Featured Product', { method: 'frappe.client.get_value', args: { 'doctype': 'Item', - 'filters': featured_product.item_code, + 'filters': {'name': featured_product.item_code}, 'fieldname': [ 'item_name', 'web_long_description', From 9421a109cfbf659153da0f74fc3c9a76c8981f13 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 29 Jul 2016 18:51:52 +0530 Subject: [PATCH 5/6] [fix] reports template --- erpnext/accounts/report/accounts_payable/accounts_payable.html | 2 +- .../accounts_payable_summary/accounts_payable_summary.html | 2 +- .../accounts_receivable_summary.html | 2 +- erpnext/accounts/report/balance_sheet/balance_sheet.html | 2 +- .../profit_and_loss_statement/profit_and_loss_statement.html | 2 +- erpnext/accounts/report/trial_balance/trial_balance.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.html b/erpnext/accounts/report/accounts_payable/accounts_payable.html index 07f9e47d81..d3020b22a4 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.html +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.html @@ -1 +1 @@ -{% include "erpnext/accounts/report/accounts_receivable/accounts_receivable.html" %} +{% include "accounts/report/accounts_receivable/accounts_receivable.html" %} diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html index 07f9e47d81..d3020b22a4 100644 --- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html +++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html @@ -1 +1 @@ -{% include "erpnext/accounts/report/accounts_receivable/accounts_receivable.html" %} +{% include "accounts/report/accounts_receivable/accounts_receivable.html" %} diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html index 07f9e47d81..d3020b22a4 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html @@ -1 +1 @@ -{% include "erpnext/accounts/report/accounts_receivable/accounts_receivable.html" %} +{% include "accounts/report/accounts_receivable/accounts_receivable.html" %} diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.html b/erpnext/accounts/report/balance_sheet/balance_sheet.html index 14dc0a639a..d4ae54d4f3 100644 --- a/erpnext/accounts/report/balance_sheet/balance_sheet.html +++ b/erpnext/accounts/report/balance_sheet/balance_sheet.html @@ -1 +1 @@ -{% include "erpnext/accounts/report/financial_statements.html" %} +{% include "accounts/report/financial_statements.html" %} diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html index 14dc0a639a..d4ae54d4f3 100644 --- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html +++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html @@ -1 +1 @@ -{% include "erpnext/accounts/report/financial_statements.html" %} +{% include "accounts/report/financial_statements.html" %} diff --git a/erpnext/accounts/report/trial_balance/trial_balance.html b/erpnext/accounts/report/trial_balance/trial_balance.html index 14dc0a639a..d4ae54d4f3 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.html +++ b/erpnext/accounts/report/trial_balance/trial_balance.html @@ -1 +1 @@ -{% include "erpnext/accounts/report/financial_statements.html" %} +{% include "accounts/report/financial_statements.html" %} From 6201068f8ffd98e114165a9c1ec521ce05822c81 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 29 Jul 2016 19:25:48 +0600 Subject: [PATCH 6/6] bumped to version 7.0.11 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b5927399d6..4470592da4 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.10' +__version__ = '7.0.11' def get_default_company(user=None): '''Get default company for user'''