Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2016-09-22 11:33:32 +05:30
commit 0967b17320
4 changed files with 36 additions and 23 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
__version__ = '7.0.45' __version__ = '7.0.46'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -124,7 +124,7 @@ def get_conditions(filters):
def get_invoices(filters): def get_invoices(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks, return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
base_net_total, base_grand_total, base_rounded_total, outstanding_amount, mode_of_payment base_net_total, base_grand_total, base_rounded_total, outstanding_amount
from `tabSales Invoice` from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" % where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1) conditions, filters, as_dict=1)
@ -196,6 +196,7 @@ def get_customer_deatils(invoice_list):
def get_mode_of_payments(invoice_list): def get_mode_of_payments(invoice_list):
mode_of_payments = {} mode_of_payments = {}
if invoice_list:
inv_mop = frappe.db.sql("""select parent, mode_of_payment inv_mop = frappe.db.sql("""select parent, mode_of_payment
from `tabSales Invoice Payment` where parent in (%s) group by parent, mode_of_payment""" % from `tabSales Invoice Payment` where parent in (%s) group by parent, mode_of_payment""" %
', '.join(['%s']*len(invoice_list)), tuple(invoice_list), as_dict=1) ', '.join(['%s']*len(invoice_list)), tuple(invoice_list), as_dict=1)

View File

@ -173,6 +173,7 @@ execute:frappe.db.set_value("Backup Manager", None, "send_backups_to_dropbox", 1
execute:frappe.db.sql_list("delete from `tabDocPerm` where parent='Issue' and modified_by='Administrator' and role='Guest'") execute:frappe.db.sql_list("delete from `tabDocPerm` where parent='Issue' and modified_by='Administrator' and role='Guest'")
erpnext.patches.v5_0.update_item_and_description_again erpnext.patches.v5_0.update_item_and_description_again
erpnext.patches.v6_0.multi_currency erpnext.patches.v6_0.multi_currency
erpnext.patches.v7_0.create_budget_record
erpnext.patches.v5_0.repost_gle_for_jv_with_multiple_party erpnext.patches.v5_0.repost_gle_for_jv_with_multiple_party
erpnext.patches.v5_0.portal_fixes erpnext.patches.v5_0.portal_fixes
erpnext.patches.v5_0.reset_values_in_tools # 02-05-2016 erpnext.patches.v5_0.reset_values_in_tools # 02-05-2016
@ -235,7 +236,6 @@ execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Taxes and Charges
erpnext.patches.v6_4.set_user_in_contact erpnext.patches.v6_4.set_user_in_contact
erpnext.patches.v6_4.make_image_thumbnail #2015-10-20 erpnext.patches.v6_4.make_image_thumbnail #2015-10-20
erpnext.patches.v6_5.show_in_website_for_template_item erpnext.patches.v6_5.show_in_website_for_template_item
erpnext.patches.v7_0.create_budget_record
erpnext.patches.v6_4.fix_expense_included_in_valuation erpnext.patches.v6_4.fix_expense_included_in_valuation
execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate") execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate")
erpnext.patches.v6_6.fix_website_image erpnext.patches.v6_6.fix_website_image

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.desk.reportview import build_match_conditions
def execute(filters=None): def execute(filters=None):
if not filters: if not filters:
@ -12,25 +13,36 @@ def execute(filters=None):
filters["from_time"] = "00:00:00" filters["from_time"] = "00:00:00"
filters["to_time"] = "24:00:00" filters["to_time"] = "24:00:00"
columns = [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("Employee Name") + "::150", columns = get_column()
_("From Datetime") + "::140", _("To Datetime") + "::140", _("Hours") + "::70", conditions = get_conditions(filters)
_("Activity Type") + "::120", _("Task") + ":Link/Task:150",
_("Project") + ":Link/Project:120", _("Status") + "::70"]
conditions = "ts.docstatus = 1"
if filters.get("from_date"):
conditions += " and tsd.from_time >= timestamp(%(from_date)s, %(from_time)s)"
if filters.get("to_date"):
conditions += " and tsd.to_time <= timestamp(%(to_date)s, %(to_time)s)"
data = get_data(conditions, filters) data = get_data(conditions, filters)
return columns, data return columns, data
def get_column():
return [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("Employee Name") + "::150",
_("From Datetime") + "::140", _("To Datetime") + "::140", _("Hours") + "::70",
_("Activity Type") + "::120", _("Task") + ":Link/Task:150",
_("Project") + ":Link/Project:120", _("Status") + "::70"]
def get_data(conditions, filters): def get_data(conditions, filters):
time_sheet = frappe.db.sql(""" select ts.name, ts.employee, ts.employee_name, time_sheet = frappe.db.sql(""" select `tabTimesheet`.name, `tabTimesheet`.employee, `tabTimesheet`.employee_name,
tsd.from_time, tsd.to_time, tsd.hours, `tabTimesheet Detail`.from_time, `tabTimesheet Detail`.to_time, `tabTimesheet Detail`.hours,
tsd.activity_type, tsd.task, tsd.project, ts.status from `tabTimesheet Detail` tsd, `tabTimesheet Detail`.activity_type, `tabTimesheet Detail`.task, `tabTimesheet Detail`.project,
`tabTimesheet` ts where ts.name = tsd.parent and %s order by ts.name"""%(conditions), filters, as_list=1) `tabTimesheet`.status from `tabTimesheet Detail`, `tabTimesheet` where
`tabTimesheet Detail`.parent = `tabTimesheet`.name and %s order by `tabTimesheet`.name"""%(conditions), filters, as_list=1)
return time_sheet return time_sheet
def get_conditions(filters):
conditions = "`tabTimesheet`.docstatus = 1"
if filters.get("from_date"):
conditions += " and `tabTimesheet Detail`.from_time >= timestamp(%(from_date)s, %(from_time)s)"
if filters.get("to_date"):
conditions += " and `tabTimesheet Detail`.to_time <= timestamp(%(to_date)s, %(to_time)s)"
match_conditions = build_match_conditions("Timesheet")
if match_conditions:
conditions += " and %s" % match_conditions
return conditions