Merge pull request #18010 from deepeshgarg007/gst_tax_rate_fixes
fix: GST report fixes
diff --git a/erpnext/assets/doctype/location/test_location.py b/erpnext/assets/doctype/location/test_location.py
index 22d25b5..c98b0b0 100644
--- a/erpnext/assets/doctype/location/test_location.py
+++ b/erpnext/assets/doctype/location/test_location.py
@@ -25,9 +25,12 @@
temp['features'][0]['properties']['feature_of'] = location
formatted_locations.extend(temp['features'])
- formatted_location_string = str(formatted_locations)
test_location = frappe.get_doc('Location', 'Test Location Area')
test_location.save()
- self.assertEqual(formatted_location_string, str(json.loads(test_location.get('location'))['features']))
+ test_location_features = json.loads(test_location.get('location'))['features']
+ ordered_test_location_features = sorted(test_location_features, key=lambda x: x['properties']['feature_of'])
+ ordered_formatted_locations = sorted(formatted_locations, key=lambda x: x['properties']['feature_of'])
+
+ self.assertEqual(ordered_formatted_locations, ordered_test_location_features)
self.assertEqual(area, test_location.get('area'))
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 4d45936..adac8f5 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -342,7 +342,7 @@
elif doc.lead:
assign_user = frappe.db.get_value('Lead', doc.lead, 'lead_owner')
- if assign_user and assign_user != 'Administrator':
+ if assign_user and assign_user not in ['Administrator', 'Guest']:
if not assign_to.get(dict(doctype = doc.doctype, name = doc.name)):
assign_to.add({
"assign_to": assign_user,
diff --git a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js
index e71ce12..b73dcf8 100644
--- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js
+++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js
@@ -2,20 +2,8 @@
// For license information, please see license.txt
frappe.ui.form.on('Employee Benefit Application', {
- setup: function(frm) {
- if(!frm.doc.employee || !frm.doc.date) {
- frappe.throw(__("Please select Employee and Date first"));
- } else {
- frm.set_query("earning_component", "employee_benefits", function() {
- return {
- query : "erpnext.hr.doctype.employee_benefit_application.employee_benefit_application.get_earning_components",
- filters: {date: frm.doc.date, employee: frm.doc.employee}
- };
- });
- }
- },
-
employee: function(frm) {
+ frm.trigger('set_earning_component');
var method, args;
if(frm.doc.employee && frm.doc.date && frm.doc.payroll_period){
method = "erpnext.hr.doctype.employee_benefit_application.employee_benefit_application.get_max_benefits_remaining";
@@ -35,6 +23,21 @@
get_max_benefits(frm, method, args);
}
},
+
+ date: function(frm) {
+ frm.trigger('set_earning_component');
+ },
+
+ set_earning_component: function(frm) {
+ if(!frm.doc.employee && !frm.doc.date) return;
+ frm.set_query("earning_component", "employee_benefits", function() {
+ return {
+ query : "erpnext.hr.doctype.employee_benefit_application.employee_benefit_application.get_earning_components",
+ filters: {date: frm.doc.date, employee: frm.doc.employee}
+ };
+ });
+ },
+
payroll_period: function(frm) {
var method, args;
if(frm.doc.employee && frm.doc.date && frm.doc.payroll_period){
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index f117903..32f0428 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -103,8 +103,8 @@
{
"billable": 1,
"activity_type": "_Test Activity Type",
- "from_type": now_datetime(),
- "hours": 3,
+ "from_time": now_datetime(),
+ "to_time": now_datetime() + datetime.timedelta(hours=3),
"company": "_Test Company"
}
)
@@ -113,8 +113,8 @@
{
"billable": 1,
"activity_type": "_Test Activity Type",
- "from_type": now_datetime(),
- "hours": 3,
+ "from_time": now_datetime(),
+ "to_time": now_datetime() + datetime.timedelta(hours=3),
"company": "_Test Company"
}
)
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js
index dcb81cb..dfdf9dc 100644
--- a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js
@@ -29,7 +29,20 @@
"placeholder":"Company GSTIN",
"options": [""],
"width": "80"
- }
+ },
+ {
+ "fieldname":"from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "width": "80"
+ },
+
],
onload: (report) => {
fetch_gstins(report);
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
index e938e29..222dfa1 100644
--- a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
@@ -88,7 +88,9 @@
for opts in (("company", " and company=%(company)s"),
("gst_hsn_code", " and gst_hsn_code=%(gst_hsn_code)s"),
- ("company_gstin", " and company_gstin=%(company_gstin)s")):
+ ("company_gstin", " and company_gstin=%(company_gstin)s"),
+ ("from_date", " and posting_date >= %(from_date)s"),
+ ("to_date", "and posting_date <= %(to_date)s")):
if filters.get(opts[0]):
conditions += opts[1]
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 4869335..1a88473 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -67,8 +67,6 @@
from frappe.model.naming import set_name_by_naming_series
set_name_by_naming_series(self)
self.item_code = self.name
- elif not self.item_code:
- msgprint(_("Item Code is mandatory because Item is not automatically numbered"), raise_exception=1)
self.item_code = strip(self.item_code)
self.name = self.item_code