Merge pull request #21940 from deepeshgarg007/acc_dim_report_filter
fix: Do not add filters in report on accounting dimension creation if it already exists
diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py
index b57e678..4480110 100644
--- a/erpnext/accounts/deferred_revenue.py
+++ b/erpnext/accounts/deferred_revenue.py
@@ -199,10 +199,13 @@
if item.get(enable_check):
_book_deferred_revenue_or_expense(item)
-def process_deferred_accounting(posting_date=today()):
+def process_deferred_accounting(posting_date=None):
''' Converts deferred income/expense into income/expense
Executed via background jobs on every month end '''
+ if not posting_date:
+ posting_date = today()
+
if not cint(frappe.db.get_singles_value('Accounts Settings', 'automatically_process_deferred_accounting_entry')):
return
diff --git a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
index d7efbad..80bccaf 100644
--- a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
+++ b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
@@ -111,7 +111,7 @@
0
end), 0) as depreciation_amount_during_the_period
from `tabAsset` a, `tabDepreciation Schedule` ds
- where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent
+ where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent and ifnull(ds.journal_entry, '') != ''
group by a.asset_category
union
SELECT a.asset_category,
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
index f88906a..b709ab9 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
@@ -4,11 +4,18 @@
frappe.query_reports["Item-wise Purchase Register"] = {
"filters": [
{
- "fieldname":"date_range",
- "label": __("Date Range"),
- "fieldtype": "DateRange",
- "default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
- "reqd": 1
+ "fieldname":"from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
+ "reqd": 1,
+ },
+ {
+ "fieldname":"to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": frappe.datetime.get_today(),
+ "reqd": 1,
},
{
"fieldname": "item_code",
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 1f78c7a..9777ed1 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -14,7 +14,6 @@
def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
if not filters: filters = {}
- filters.update({"from_date": filters.get("date_range")[0], "to_date": filters.get("date_range")[1]})
columns = get_columns(additional_table_columns, filters)
company_currency = erpnext.get_company_currency(filters.company)
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
index 8a9c76f..39fb3ca 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
@@ -4,11 +4,18 @@
frappe.query_reports["Item-wise Sales Register"] = {
"filters": [
{
- "fieldname": "date_range",
- "label": __("Date Range"),
- "fieldtype": "DateRange",
- "default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
- "reqd": 1
+ "fieldname":"from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
+ "reqd": 1,
+ },
+ {
+ "fieldname":"to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": frappe.datetime.get_today(),
+ "reqd": 1,
},
{
"fieldname": "customer",
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 92a22e6..bb78ee2 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -14,7 +14,6 @@
def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
if not filters: filters = {}
- filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
columns = get_columns(additional_table_columns, filters)
company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency")
diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.js b/erpnext/buying/doctype/buying_settings/buying_settings.js
index a27950a..01b40cd 100644
--- a/erpnext/buying/doctype/buying_settings/buying_settings.js
+++ b/erpnext/buying/doctype/buying_settings/buying_settings.js
@@ -11,7 +11,7 @@
{
fieldname: "supp_master_name",
title: "Supplier Naming By",
- description: __("By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a set ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/setting-up/settings/naming-series'>Naming Series</a>" + __(" choose the 'Naming Series' option."),
+ description: __("By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a set ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/setting-up/settings/naming-series' target='_blank'>Naming Series</a>" + __(" choose the 'Naming Series' option."),
},
{
fieldname: "buying_price_list",
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 1e0a48c..b696ac3 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -361,7 +361,7 @@
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
def set_gross_profit(self):
- if self.doctype == "Sales Order":
+ if self.doctype in ["Sales Order", "Quotation"]:
for item in self.items:
item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))
diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
new file mode 100644
index 0000000..c36dfb1
--- /dev/null
+++ b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'assessment_plan',
+ 'non_standard_fieldnames': {
+ },
+ 'transactions': [
+ {
+ 'label': _('Assessment'),
+ 'items': ['Assessment Result']
+ }
+ ]
+ }
\ No newline at end of file
diff --git a/erpnext/education/doctype/course/course_dashboard.py b/erpnext/education/doctype/course/course_dashboard.py
new file mode 100644
index 0000000..752af29
--- /dev/null
+++ b/erpnext/education/doctype/course/course_dashboard.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'course',
+ 'non_standard_fieldnames': {
+ },
+ 'transactions': [
+ {
+ 'label': _('Course'),
+ 'items': ['Course Enrollment', 'Course Schedule']
+ },
+ {
+ 'label': _('Student'),
+ 'items': ['Student Group']
+ },
+ {
+ 'label': _('Assessment'),
+ 'items': ['Assessment Plan']
+ },
+ ]
+ }
\ No newline at end of file
diff --git a/erpnext/erpnext_integrations/connectors/shopify_connection.py b/erpnext/erpnext_integrations/connectors/shopify_connection.py
index ca0e160..7046038 100644
--- a/erpnext/erpnext_integrations/connectors/shopify_connection.py
+++ b/erpnext/erpnext_integrations/connectors/shopify_connection.py
@@ -95,10 +95,10 @@
items = get_order_items(shopify_order.get("line_items"), shopify_settings)
if not items:
- message = 'Following items are exists in order but relevant record not found in Product master'
+ message = 'Following items exists in the shopify order but relevant records were not found in the shopify Product master'
message += "\n" + ", ".join(product_not_exists)
- make_shopify_log(status="Error", exception=e, rollback=True)
+ make_shopify_log(status="Error", exception=message, rollback=True)
return ''
diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
index 44f87e0..1b0c9f6 100644
--- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
+++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
@@ -182,7 +182,8 @@
company_abbr = frappe.db.get_value('Company', woocommerce_settings.company, 'abbr')
default_warehouse = _("Stores - {0}", sys_lang).format(company_abbr)
- if not frappe.db.exists("Warehouse", default_warehouse):
+ if not frappe.db.exists("Warehouse", default_warehouse) \
+ and not woocommerce_settings.warehouse:
frappe.throw(_("Please set Warehouse in Woocommerce Settings"))
for item in order.get("line_items"):
diff --git a/erpnext/healthcare/dashboard_fixtures.py b/erpnext/healthcare/dashboard_fixtures.py
index 59da71a..967117d 100644
--- a/erpnext/healthcare/dashboard_fixtures.py
+++ b/erpnext/healthcare/dashboard_fixtures.py
@@ -19,7 +19,7 @@
else:
company = frappe.get_list("Company", limit=1)
if company:
- return company.name
+ return company[0].name
return None
def get_dashboards():
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
index 3952a81..15c9434 100644
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
+++ b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
@@ -11,6 +11,7 @@
"patient",
"assessment_template",
"column_break_4",
+ "company",
"healthcare_practitioner",
"assessment_datetime",
"assessment_description",
@@ -127,11 +128,18 @@
"fieldname": "assessment_description",
"fieldtype": "Small Text",
"label": "Assessment Description"
+ },
+ {
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "in_standard_filter": 1,
+ "label": "Company",
+ "options": "Company"
}
],
"is_submittable": 1,
"links": [],
- "modified": "2020-04-21 13:23:09.815007",
+ "modified": "2020-05-25 14:38:38.302399",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient Assessment",
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.json b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
index c352287..016cfbc 100644
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.json
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
@@ -85,11 +85,9 @@
{
"fieldname": "company",
"fieldtype": "Link",
- "hidden": 1,
+ "in_standard_filter": 1,
"label": "Company",
- "options": "Company",
- "print_hide": 1,
- "report_hide": 1
+ "options": "Company"
},
{
"fieldname": "section_break_6",
@@ -167,7 +165,7 @@
],
"is_submittable": 1,
"links": [],
- "modified": "2020-04-04 19:17:02.707203",
+ "modified": "2020-05-25 14:36:46.990469",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Sample Collection",
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
index ca78b66..9edfeb2 100644
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
+++ b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
@@ -10,6 +10,7 @@
"patient",
"patient_name",
"column_break_4",
+ "company",
"status",
"start_date",
"section_break_3",
@@ -98,10 +99,17 @@
"label": "Status",
"options": "Not Started\nIn Progress\nCompleted\nCancelled",
"read_only": 1
+ },
+ {
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "in_standard_filter": 1,
+ "label": "Company",
+ "options": "Company"
}
],
"links": [],
- "modified": "2020-04-21 13:13:43.956014",
+ "modified": "2020-05-25 14:38:53.649315",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Therapy Plan",
diff --git a/erpnext/healthcare/setup.py b/erpnext/healthcare/setup.py
index 2087f49..0684080 100644
--- a/erpnext/healthcare/setup.py
+++ b/erpnext/healthcare/setup.py
@@ -195,10 +195,21 @@
def add_healthcare_service_unit_tree_root():
record = [
- {
- "doctype": "Healthcare Service Unit",
- "healthcare_service_unit_name": "All Healthcare Service Units",
- "is_group": 1
- }
+ {
+ "doctype": "Healthcare Service Unit",
+ "healthcare_service_unit_name": "All Healthcare Service Units",
+ "is_group": 1,
+ "company": get_company()
+ }
]
insert_record(record)
+
+def get_company():
+ company = frappe.defaults.get_defaults().company
+ if company:
+ return company
+ else:
+ company = frappe.get_list("Company", limit=1)
+ if company:
+ return company[0].name
+ return None
diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py
index f092578..9abaa07 100644
--- a/erpnext/healthcare/utils.py
+++ b/erpnext/healthcare/utils.py
@@ -512,10 +512,10 @@
def get_patient_vitals(patient, from_date=None, to_date=None):
if not patient: return
- vitals = frappe.db.get_all('Vital Signs', {
+ vitals = frappe.db.get_all('Vital Signs', filters={
'docstatus': 1,
'patient': patient
- }, order_by='signs_date, signs_time')
+ }, order_by='signs_date, signs_time', fields=['*'])
if len(vitals):
return vitals
diff --git a/erpnext/hr/desk_page/hr/hr.json b/erpnext/hr/desk_page/hr/hr.json
index 2d0e885..33132a6 100644
--- a/erpnext/hr/desk_page/hr/hr.json
+++ b/erpnext/hr/desk_page/hr/hr.json
@@ -89,11 +89,10 @@
"docstatus": 0,
"doctype": "Desk Page",
"extends_another_page": 0,
- "hide_custom": 0,
"idx": 0,
"is_standard": 1,
"label": "HR",
- "modified": "2020-05-20 11:20:54.255557",
+ "modified": "2020-05-23 12:41:52.543438",
"modified_by": "Administrator",
"module": "HR",
"name": "HR",
@@ -127,7 +126,7 @@
"type": "DocType"
},
{
- "label": "Salary Register",
+ "label": "Monthly Attendance Sheet",
"link_to": "Monthly Attendance Sheet",
"type": "Report"
},
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 84f2c83..f2968bc 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -438,14 +438,23 @@
leave_allocation = {}
for d in allocation_records:
allocation = allocation_records.get(d, frappe._dict())
+
+ total_allocated_leaves = frappe.db.get_value('Leave Allocation', {
+ 'from_date': ('<=', date),
+ 'to_date': ('>=', date),
+ 'leave_type': allocation.leave_type,
+ }, 'SUM(total_leaves_allocated)') or 0
+
remaining_leaves = get_leave_balance_on(employee, d, date, to_date = allocation.to_date,
consider_all_leaves_in_the_allocation_period=True)
+
end_date = allocation.to_date
leaves_taken = get_leaves_for_period(employee, d, allocation.from_date, end_date) * -1
leaves_pending = get_pending_leaves_for_period(employee, d, allocation.from_date, end_date)
leave_allocation[d] = {
- "total_leaves": allocation.total_leaves_allocated,
+ "total_leaves": total_allocated_leaves,
+ "expired_leaves": total_allocated_leaves - (remaining_leaves + leaves_taken),
"leaves_taken": leaves_taken,
"pending_leaves": leaves_pending,
"remaining_leaves": remaining_leaves}
diff --git a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
index 2385b6a..295f3b4 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
+++ b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
@@ -4,11 +4,12 @@
<table class="table table-bordered small">
<thead>
<tr>
- <th style="width: 20%">{{ __("Leave Type") }}</th>
- <th style="width: 20%" class="text-right">{{ __("Total Allocated Leaves") }}</th>
- <th style="width: 20%" class="text-right">{{ __("Used Leaves") }}</th>
- <th style="width: 20%" class="text-right">{{ __("Pending Leaves") }}</th>
- <th style="width: 20%" class="text-right">{{ __("Available Leaves") }}</th>
+ <th style="width: 16%">{{ __("Leave Type") }}</th>
+ <th style="width: 16%" class="text-right">{{ __("Total Allocated Leaves") }}</th>
+ <th style="width: 16%" class="text-right">{{ __("Expired Leaves") }}</th>
+ <th style="width: 16%" class="text-right">{{ __("Used Leaves") }}</th>
+ <th style="width: 16%" class="text-right">{{ __("Pending Leaves") }}</th>
+ <th style="width: 16%" class="text-right">{{ __("Available Leaves") }}</th>
</tr>
</thead>
@@ -17,6 +18,7 @@
<tr>
<td> {%= key %} </td>
<td class="text-right"> {%= value["total_leaves"] %} </td>
+ <td class="text-right"> {%= value["expired_leaves"] %} </td>
<td class="text-right"> {%= value["leaves_taken"] %} </td>
<td class="text-right"> {%= value["pending_leaves"] %} </td>
<td class="text-right"> {%= value["remaining_leaves"] %} </td>
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index 61faea1..edf05e8 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -22,6 +22,9 @@
args = frappe.local.form_dict
+ if getdate(args.from_date) > getdate(args.to_date):
+ frappe.throw(_("To Date should be greater than From Date"))
+
w = UnicodeWriter()
w = add_header(w)
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index 97be5cd..db1d191 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -3,13 +3,13 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import flt
+from frappe.utils import flt, add_days
from frappe import _
-from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on, get_leave_allocation_records
+from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on
def execute(filters=None):
if filters.to_date <= filters.from_date:
- frappe.throw(_('From date can not be greater than than To date'))
+ frappe.throw(_('"From date" can not be greater than or equal to "To date"'))
columns = get_columns()
data = get_data(filters)
@@ -104,14 +104,17 @@
new_allocation, expired_leaves = get_allocated_and_expired_leaves(filters.from_date, filters.to_date, employee.name, leave_type)
- opening = get_leave_balance_on(employee.name, leave_type, filters.from_date)
- closing = get_leave_balance_on(employee.name, leave_type, filters.to_date)
+ opening = get_leave_balance_on(employee.name, leave_type, add_days(filters.from_date, -1)) #allocation boundary condition
row.leaves_allocated = new_allocation
row.leaves_expired = expired_leaves - leaves_taken if expired_leaves - leaves_taken > 0 else 0
row.opening_balance = opening
row.leaves_taken = leaves_taken
- row.closing_balance = closing
+
+ # not be shown on the basis of days left it create in user mind for carry_forward leave
+ row.closing_balance = (new_allocation + opening - (row.leaves_expired + leaves_taken))
+
+
row.indent = 1
data.append(row)
new_leaves_allocated = 0
@@ -177,7 +180,7 @@
}, as_dict=1)
for record in records:
- if record.to_date <= getdate(to_date):
+ if record.to_date < getdate(to_date):
expired_leaves += record.leaves
if record.from_date >= getdate(from_date):
diff --git a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
index a5cdecf..92715d3 100644
--- a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
+++ b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
@@ -6,7 +6,7 @@
from frappe import _
from frappe.utils import flt
from erpnext.hr.doctype.leave_application.leave_application \
- import get_leave_balance_on, get_leaves_for_period
+ import get_leave_details
from erpnext.hr.report.employee_leave_balance.employee_leave_balance \
import get_department_leave_approver_map
@@ -61,14 +61,14 @@
if (len(leave_approvers) and user in leave_approvers) or (user in ["Administrator", employee.user_id]) or ("HR Manager" in frappe.get_roles(user)):
row = [employee.name, employee.employee_name, employee.department]
-
+ available_leave = get_leave_details(employee.name, filters.date)
for leave_type in leave_types:
-
+ remaining = 0
+ if leave_type in available_leave["leave_allocation"]:
# opening balance
- opening = get_leave_balance_on(employee.name, leave_type, filters.date)
+ remaining = available_leave["leave_allocation"][leave_type]['remaining_leaves']
-
- row += [opening]
+ row += [remaining]
data.append(row)
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index 60767b5..47daab1 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -135,7 +135,7 @@
row += [emp, emp_det.employee_name]
total_p = total_a = total_l = total_h = total_um= 0.0
- ggg = []
+ emp_status_map = []
for day in range(filters["total_days_in_month"]):
status = None
status = att_map.get(emp).get(day + 1)
@@ -152,11 +152,10 @@
status = "Holiday"
total_h += 1
- ggg.append(status_map.get(status, ""))
+ abbr = status_map.get(status, "")
+ emp_status_map.append(abbr)
- if not filters.summarized_view:
- row += ggg
- else:
+ if filters.summarized_view:
if status == "Present" or status == "Work From Home":
total_p += 1
elif status == "Absent":
@@ -170,6 +169,9 @@
elif not status:
total_um += 1
+ if not filters.summarized_view:
+ row += emp_status_map
+
if filters.summarized_view:
row += [total_p, total_l, total_a, total_h, total_um]
@@ -203,7 +205,7 @@
row.append("0.0")
row.extend([time_default_counts[0][0],time_default_counts[0][1]])
- emp_att_map[emp] = ggg
+ emp_att_map[emp] = emp_status_map
record.append(row)
return record, emp_att_map
@@ -216,7 +218,7 @@
columns = [_(filters.group_by)+ ":Link/Branch:120"]
columns += [
- _("Employee") + ":Link/Employee:120", _("Employee Name") + ":Link/Employee:120"
+ _("Employee") + ":Link/Employee:120", _("Employee Name") + ":Data/:120"
]
days = []
for day in range(filters["total_days_in_month"]):
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index cb82901..929f8d6 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -688,7 +688,8 @@
erpnext.patches.v12_0.update_price_list_currency_in_bom
execute:frappe.delete_doc_if_exists('Dashboard', 'Accounts')
erpnext.patches.v13_0.update_actual_start_and_end_date_in_wo
-erpnext.patches.v13_0.set_company_field_in_healthcare_doctypes
+erpnext.patches.v13_0.set_company_field_in_healthcare_doctypes #2020-05-25
erpnext.patches.v12_0.update_bom_in_so_mr
execute:frappe.delete_doc("Report", "Department Analytics")
execute:frappe.rename_doc("Desk Page", "Loan Management", "Loan", force=True)
+erpnext.patches.v12_0.update_uom_conversion_factor
diff --git a/erpnext/patches/v12_0/update_uom_conversion_factor.py b/erpnext/patches/v12_0/update_uom_conversion_factor.py
new file mode 100644
index 0000000..b5a20aa
--- /dev/null
+++ b/erpnext/patches/v12_0/update_uom_conversion_factor.py
@@ -0,0 +1,11 @@
+from __future__ import unicode_literals
+import frappe, json
+
+def execute():
+ from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data
+
+ frappe.reload_doc("setup", "doctype", "UOM Conversion Factor")
+ frappe.reload_doc("setup", "doctype", "UOM")
+ frappe.reload_doc("stock", "doctype", "UOM Category")
+
+ add_uom_data()
\ No newline at end of file
diff --git a/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py b/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
index 9d0dae4..a7d4c66 100644
--- a/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
+++ b/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
@@ -3,8 +3,8 @@
def execute():
company = frappe.db.get_single_value('Global Defaults', 'default_company')
- doctypes = ['Clinical Procedure', 'Inpatient Record', 'Lab Test', 'Patient Appointment', 'Patient Encounter', 'Vital Signs']
+ doctypes = ['Clinical Procedure', 'Inpatient Record', 'Lab Test', 'Sample Collection' 'Patient Appointment', 'Patient Encounter', 'Vital Signs', 'Therapy Session', 'Therapy Plan', 'Patient Assessment']
for entry in doctypes:
if frappe.db.exists('DocType', entry):
- frappe.reload_doc("Healthcare", "doctype", entry)
+ frappe.reload_doc('Healthcare', 'doctype', entry)
frappe.db.sql("update `tab{dt}` set company = '{company}' where ifnull(company, '') = ''".format(dt=entry, company=company))
diff --git a/erpnext/patches/v7_0/update_mins_to_first_response.py b/erpnext/patches/v7_0/update_mins_to_first_response.py
index 1df4b42..1668135 100644
--- a/erpnext/patches/v7_0/update_mins_to_first_response.py
+++ b/erpnext/patches/v7_0/update_mins_to_first_response.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.core.doctype.communication.email import update_mins_to_first_communication
+from frappe.core.doctype.communication.communication import update_mins_to_first_communication
def execute():
frappe.reload_doctype('Issue')
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 637d3b3..524a958 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1711,7 +1711,7 @@
},
set_gross_profit: function(item) {
- if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) {
+ if (["Sales Order", "Quotation"].includes(this.frm.doc.doctype) && item.valuation_rate) {
var rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1);
item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item));
}
diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py
index a01c6ce..772bbf5 100644
--- a/erpnext/regional/united_arab_emirates/utils.py
+++ b/erpnext/regional/united_arab_emirates/utils.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+import frappe
from frappe.utils import flt
from erpnext.controllers.taxes_and_totals import get_itemised_tax
+from six import iteritems
def update_itemised_tax_data(doc):
if not doc.taxes: return
@@ -9,7 +11,14 @@
for row in doc.items:
tax_rate = 0.0
- if itemised_tax.get(row.item_code):
+ item_tax_rate = frappe.parse_json(row.item_tax_rate)
+
+ # First check if tax rate is present
+ # If not then look up in item_wise_tax_detail
+ if item_tax_rate:
+ for account, rate in iteritems(item_tax_rate):
+ tax_rate += rate
+ elif itemised_tax.get(row.item_code):
tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()])
row.tax_rate = flt(tax_rate, row.precision("tax_rate"))
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 7cfec5a..0e771c3 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -197,9 +197,9 @@
cond = "qo.docstatus = 1 and qo.status != 'Expired' and qo.valid_till < %s"
# check if those QUO have SO against it
so_against_quo = """
- SELECT
+ SELECT
so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
- WHERE
+ WHERE
so_item.docstatus = 1 and so.docstatus = 1
and so_item.parent = so.name
and so_item.prevdoc_docname = qo.name"""
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index d50397c..59ae7b2 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -48,6 +48,10 @@
"base_net_amount",
"pricing_rules",
"is_free_item",
+ "section_break_43",
+ "valuation_rate",
+ "column_break_45",
+ "gross_profit",
"item_weight_details",
"weight_per_unit",
"total_weight",
@@ -602,12 +606,40 @@
"label": "Against Blanket Order",
"no_copy": 1,
"print_hide": 1
+ },
+ {
+ "fieldname": "section_break_43",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "valuation_rate",
+ "fieldtype": "Currency",
+ "label": "Valuation Rate",
+ "no_copy": 1,
+ "options": "Company:company:default_currency",
+ "print_hide": 1,
+ "read_only": 1,
+ "report_hide": 1
+ },
+ {
+ "fieldname": "column_break_45",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "gross_profit",
+ "fieldtype": "Currency",
+ "label": "Gross Profit",
+ "no_copy": 1,
+ "options": "Company:company:default_currency",
+ "print_hide": 1,
+ "read_only": 1,
+ "report_hide": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-03-30 18:40:28.782720",
+ "modified": "2020-05-19 20:48:43.222229",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",
diff --git a/erpnext/setup/setup_wizard/data/uom_conversion_data.json b/erpnext/setup/setup_wizard/data/uom_conversion_data.json
index 174ecd5..27a917d 100644
--- a/erpnext/setup/setup_wizard/data/uom_conversion_data.json
+++ b/erpnext/setup/setup_wizard/data/uom_conversion_data.json
@@ -1571,5 +1571,19 @@
"to_uom": "Parts Per Million",
"abbr": "ppm",
"value": "10000"
+ },
+ {
+ "category": "Mass",
+ "from_uom": "Pound",
+ "to_uom": "Ounce",
+ "abbr": "oz",
+ "value": "16"
+ },
+ {
+ "category": "Mass",
+ "from_uom": "Gram",
+ "to_uom": "Ounce",
+ "abbr": "oz",
+ "value": "0.035274"
}
]
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index 8bb0a05..0d70d91 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -336,13 +336,14 @@
"category_name": _(d.get("category"))
}).insert(ignore_permissions=True)
- uom_conversion = frappe.get_doc({
- "doctype": "UOM Conversion Factor",
- "category": _(d.get("category")),
- "from_uom": _(d.get("from_uom")),
- "to_uom": _(d.get("to_uom")),
- "value": d.get("value")
- }).insert(ignore_permissions=True)
+ if not frappe.db.exists("UOM Conversion Factor", {"from_uom": _(d.get("from_uom")), "to_uom": _(d.get("to_uom"))}):
+ uom_conversion = frappe.get_doc({
+ "doctype": "UOM Conversion Factor",
+ "category": _(d.get("category")),
+ "from_uom": _(d.get("from_uom")),
+ "to_uom": _(d.get("to_uom")),
+ "value": d.get("value")
+ }).insert(ignore_permissions=True)
def add_market_segments():
records = [
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 4ac546e..d04c8c2 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -319,7 +319,7 @@
def set_price_list_and_rate(quotation, cart_settings):
"""set price list based on billing territory"""
- _set_price_list(quotation, cart_settings)
+ _set_price_list(cart_settings, quotation)
# reset values
quotation.price_list_currency = quotation.currency = \
@@ -334,23 +334,28 @@
# set it in cookies for using in product page
frappe.local.cookie_manager.set_cookie("selling_price_list", quotation.selling_price_list)
-def _set_price_list(quotation, cart_settings):
+def _set_price_list(cart_settings, quotation=None):
"""Set price list based on customer or shopping cart default"""
from erpnext.accounts.party import get_default_price_list
# check if customer price list exists
selling_price_list = None
- if quotation.party_name:
- selling_price_list = frappe.db.get_value('Customer', quotation.party_name, 'default_price_list')
+ if quotation and quotation.get("party_name"):
+ selling_price_list = frappe.db.get_value('Customer', quotation.get("party_name"), 'default_price_list')
# else check for territory based price list
if not selling_price_list:
selling_price_list = cart_settings.price_list
- if not selling_price_list and quotation.party_name:
- selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.party_name))
+ party_name = quotation.get("party_name") if quotation else get_party().get("name")
- quotation.selling_price_list = selling_price_list
+ if not selling_price_list and party_name:
+ selling_price_list = get_default_price_list(frappe.get_doc("Customer", party_name))
+
+ if quotation:
+ quotation.selling_price_list = selling_price_list
+
+ return selling_price_list
def set_taxes(quotation, cart_settings):
"""set taxes based on billing territory"""
diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py
index 21ee335..7c08f5b 100644
--- a/erpnext/shopping_cart/product_info.py
+++ b/erpnext/shopping_cart/product_info.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
-from erpnext.shopping_cart.cart import _get_cart_quotation
+from erpnext.shopping_cart.cart import _get_cart_quotation, _set_price_list
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \
import get_shopping_cart_settings, show_quantity_in_website
from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status
@@ -21,9 +21,11 @@
if not skip_quotation_creation:
cart_quotation = _get_cart_quotation()
+ selling_price_list = cart_quotation.get("selling_price_list") if cart_quotation else _set_price_list(cart_settings, None)
+
price = get_price(
item_code,
- cart_quotation.selling_price_list,
+ selling_price_list,
cart_settings.default_customer_group,
cart_settings.company
)
@@ -42,7 +44,7 @@
if product_info["price"]:
if frappe.session.user != "Guest":
- item = cart_quotation.get({"item_code": item_code})
+ item = cart_quotation.get({"item_code": item_code}) if cart_quotation else None
if item:
product_info["qty"] = item[0].qty
diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js
index d46b98b..3a5ef76 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.js
+++ b/erpnext/stock/doctype/pick_list/pick_list.js
@@ -31,10 +31,16 @@
};
});
frm.set_query('item_code', 'locations', () => {
+ return erpnext.queries.item({ "is_stock_item": 1 });
+ });
+ frm.set_query('batch_no', 'locations', (frm, cdt, cdn) => {
+ const row = locals[cdt][cdn];
return {
+ query: 'erpnext.controllers.queries.get_batch_no',
filters: {
- is_stock_item: 1
- }
+ item_code: row.item_code,
+ warehouse: row.warehouse
+ },
};
});
},
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 1f8d009..93b29c8 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -24,6 +24,9 @@
for item in self.locations:
if not frappe.get_cached_value('Item', item.item_code, 'has_serial_no'):
continue
+ if not item.serial_no:
+ frappe.throw(_("Row #{0}: {1} does not have any available serial numbers in {2}".format(
+ frappe.bold(item.idx), frappe.bold(item.item_code), frappe.bold(item.warehouse))))
if len(item.serial_no.split('\n')) == item.picked_qty:
continue
frappe.throw(_('For item {0} at row {1}, count of serial numbers does not match with the picked quantity')
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.js b/erpnext/stock/doctype/stock_settings/stock_settings.js
index 6f97572..877d0c3 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.js
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.js
@@ -36,7 +36,7 @@
{
fieldname: "valuation_method",
title: __("Valuation Method"),
- description: __("Choose between FIFO and Moving Average Valuation Methods. Click ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/stock/articles/item-valuation-fifo-and-moving-average'>here</a>" + __(" to know more about them.")
+ description: __("Choose between FIFO and Moving Average Valuation Methods. Click ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/stock/articles/item-valuation-fifo-and-moving-average' target='_blank'>here</a>" + __(" to know more about them.")
},
{
fieldname: "show_barcode_field",
diff --git a/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json b/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
index 447611f..009a44f 100644
--- a/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
+++ b/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
@@ -8,12 +8,12 @@
"is_mandatory": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2020-05-19 18:55:41.457289",
+ "modified": "2020-05-26 15:55:41.457289",
"modified_by": "Administrator",
"name": "Introduction to Stock Entry",
"owner": "Administrator",
"show_full_form": 0,
- "title": "Introduction to the multi-purpose stock transaction",
+ "title": "Introduction to Stock Entry",
"validate_action": 1,
"video_url": "https://www.youtube.com/watch?v=Njt107hlY3I"
}
\ No newline at end of file
diff --git a/erpnext/www/all-products/index.html b/erpnext/www/all-products/index.html
index f090214..0126b59 100644
--- a/erpnext/www/all-products/index.html
+++ b/erpnext/www/all-products/index.html
@@ -11,7 +11,7 @@
<div class="input-group input-group-sm mb-3">
<input type="search" class="form-control" placeholder="{{_('Search')}}"
aria-label="{{_('Product Search')}}" aria-describedby="product-search"
- value="{{ frappe.form_dict.search or '' }}"
+ value="{{ frappe.sanitize_html(frappe.form_dict.search) or '' }}"
>
</div>
</div>