diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 75e7361b389..4bc1d068740 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.41' +__version__ = '10.1.42' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py b/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py index 93ea11c6404..2886546c3a9 100644 --- a/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py +++ b/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py @@ -9,7 +9,7 @@ from frappe.utils import flt,cstr from erpnext.accounts.report.financial_statements import get_period_list def execute(filters=None): - columns, data = [], [] + columns, data, chart = [], [], [] if filters.get('fiscal_year'): company = erpnext.get_default_company() period_list = get_period_list(filters.get('fiscal_year'), filters.get('fiscal_year'),"Monthly", company) diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 1f4bd005c6c..3cb91018b6d 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -298,7 +298,7 @@ class Project(Document): dt_name = frappe.db.get_value('Task', {"subject": dt, "project": self.name }) task_doc.append('depends_on', {"task": dt_name}) - task_doc.update_db() + task_doc.db_update() def get_timeline_data(doctype, name): '''Return timeline for attendance''' diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js index 90244ce9f6d..67051c8b5e5 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js @@ -59,5 +59,11 @@ frappe.query_reports["Sales Person-wise Transaction Summary"] = { fieldtype: "Link", options: "Territory", }, + { + fieldname:"show_return_entries", + label: __("Show Return Entries"), + fieldtype: "Check", + default: 0, + }, ] } \ No newline at end of file diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py index 19b6774ce9f..ae2cf8c550e 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py @@ -15,7 +15,7 @@ def execute(filters=None): data = [] for d in entries: - if d.stock_qty > 0: + if d.stock_qty > 0 or filters.get('show_return_entries', 0): data.append([ d.name, d.customer, d.territory, d.posting_date, d.item_code, item_details.get(d.item_code, {}).get("item_group"), item_details.get(d.item_code, {}).get("brand"), diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 0cab383176a..dc9917a368e 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -417,8 +417,9 @@ class EmailDigest(Document): value, count, billed_value, delivered_value = frappe.db.sql("""select ifnull(sum(grand_total),0), count(*), ifnull(sum(grand_total*per_billed/100),0), ifnull(sum(grand_total*{0}/100),0) from `tab{1}` where (transaction_date <= %(to_date)s) - and status not in ('Closed','Cancelled', 'Completed') """.format(getfield, doc_type), - {"to_date": self.future_to_date})[0] + and status not in ('Closed','Cancelled', 'Completed') + and company = %(company)s """.format(getfield, doc_type), + {"to_date": self.future_to_date, "company": self.company})[0] return { "label": self.meta.get_label(fieldname), @@ -432,11 +433,13 @@ class EmailDigest(Document): value, count = frappe.db.sql("""select ifnull(sum(grand_total),0), count(*) from `tabQuotation` where (transaction_date <= %(to_date)s) - and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.future_to_date})[0] + and company = %(company)s + and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.future_to_date, "company": self.company})[0] last_value = frappe.db.sql("""select ifnull(sum(grand_total),0) from `tabQuotation` where (transaction_date <= %(to_date)s) - and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.past_to_date})[0][0] + and company = %(company)s + and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.past_to_date, "company": self.company})[0][0] return { "label": self.meta.get_label(fieldname), @@ -462,8 +465,9 @@ class EmailDigest(Document): def get_total_on(self, doc_type, from_date, to_date): return frappe.db.sql("""select ifnull(sum(grand_total),0), count(*) from `tab{0}` - where (transaction_date between %(from_date)s and %(to_date)s) and status not in ('Cancelled')""".format(doc_type), - {"from_date": from_date, "to_date": to_date})[0] + where (transaction_date between %(from_date)s and %(to_date)s) and company=%(company)s + and status not in ('Cancelled')""".format(doc_type), + {"from_date": from_date, "to_date": to_date, "company": self.company})[0] def get_from_to_date(self): today = now_datetime().date()