From b34ab7549a96e244440c9b71017c1a7c25b6f613 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 12 Mar 2018 15:24:01 +0530 Subject: [PATCH] fixed subject to task_name (#13278) --- erpnext/agriculture/doctype/crop/crop.py | 3 ++- erpnext/agriculture/doctype/disease/disease.py | 3 ++- erpnext/agriculture/doctype/soil_texture/soil_texture.py | 5 +++-- erpnext/agriculture/doctype/water_analysis/water_analysis.py | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/agriculture/doctype/crop/crop.py b/erpnext/agriculture/doctype/crop/crop.py index 7eeb8af6ce7..ca928f862bc 100644 --- a/erpnext/agriculture/doctype/crop/crop.py +++ b/erpnext/agriculture/doctype/crop/crop.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from frappe import _ class Crop(Document): def validate(self): @@ -12,7 +13,7 @@ class Crop(Document): for task in self.agriculture_task: # validate start_day is not > end_day if task.start_day > task.end_day: - frappe.throw("Start day is greater than end day in task '{0}'".format(task.subject)) + frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name)) # to calculate the period of the Crop Cycle if task.end_day > max_period: max_period = task.end_day if max_period > self.period: self.period = max_period diff --git a/erpnext/agriculture/doctype/disease/disease.py b/erpnext/agriculture/doctype/disease/disease.py index 42005d6b06c..f7cd7df1800 100644 --- a/erpnext/agriculture/doctype/disease/disease.py +++ b/erpnext/agriculture/doctype/disease/disease.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from frappe import _ class Disease(Document): def validate(self): @@ -12,7 +13,7 @@ class Disease(Document): for task in self.treatment_task: # validate start_day is not > end_day if task.start_day > task.end_day: - frappe.throw("Start day is greater than end day in task '{0}'".format(task.task_name)) + frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name)) # to calculate the period of the Crop Cycle if task.end_day > max_period: max_period = task.end_day self.treatment_period = max_period \ No newline at end of file diff --git a/erpnext/agriculture/doctype/soil_texture/soil_texture.py b/erpnext/agriculture/doctype/soil_texture/soil_texture.py index 7345e862b95..26c5d5c0e49 100644 --- a/erpnext/agriculture/doctype/soil_texture/soil_texture.py +++ b/erpnext/agriculture/doctype/soil_texture/soil_texture.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe.utils import flt, cint +from frappe import _ class SoilTexture(Document): soil_edit_order = [2, 1, 0] @@ -20,9 +21,9 @@ class SoilTexture(Document): self.update_soil_edit('sand_composition') for soil_type in self.soil_types: if self.get(soil_type) > 100 or self.get(soil_type) < 0: - frappe.throw("{0} should be a value between 0 and 100".format(soil_type)) + frappe.throw(_("{0} should be a value between 0 and 100").format(soil_type)) if sum(self.get(soil_type) for soil_type in self.soil_types) != 100: - frappe.throw('Soil compositions do not add up to 100') + frappe.throw(_('Soil compositions do not add up to 100')) def update_soil_edit(self, soil_type): self.soil_edit_order[self.soil_types.index(soil_type)] = max(self.soil_edit_order)+1 diff --git a/erpnext/agriculture/doctype/water_analysis/water_analysis.py b/erpnext/agriculture/doctype/water_analysis/water_analysis.py index 81fdf14a372..4d3cde075dd 100644 --- a/erpnext/agriculture/doctype/water_analysis/water_analysis.py +++ b/erpnext/agriculture/doctype/water_analysis/water_analysis.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from frappe import _ class WaterAnalysis(Document): def load_contents(self): @@ -18,6 +19,6 @@ class WaterAnalysis(Document): def validate(self): if self.collection_datetime > self.laboratory_testing_datetime: - frappe.throw('Lab testing datetime cannot be before collection datetime') + frappe.throw(_('Lab testing datetime cannot be before collection datetime')) if self.laboratory_testing_datetime > self.result_datetime: - frappe.throw('Lab result datetime cannot be before testing datetime') \ No newline at end of file + frappe.throw(_('Lab result datetime cannot be before testing datetime')) \ No newline at end of file