fixed subject to task_name (#13278)
This commit is contained in:
parent
aa54d934b8
commit
b34ab7549a
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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')
|
||||
frappe.throw(_('Lab result datetime cannot be before testing datetime'))
|
Loading…
x
Reference in New Issue
Block a user