fix: service unit validation and translation

This commit is contained in:
Rucha Mahabal 2020-05-21 09:02:46 +05:30
parent 94762ff4ff
commit d9d1f442df

View File

@ -12,12 +12,14 @@ class HealthcareServiceUnitType(Document):
def validate(self):
if self.allow_appointments and self.inpatient_occupancy:
frappe.msgprint(
_('Healthcare Service Unit Type cannot be both <b>Allow Appointments</b> and <b>Inpatient Occupancy</b>'),
_('Healthcare Service Unit Type cannot have both {0} and {1}').format(
frappe.bold('Allow Appointments'), frappe.bold('Inpatient Occupancy')),
raise_exception=1, title=_('Validation Error'), indicator='red'
)
elif not self.allow_appointments and not self.inpatient_occupancy:
frappe.msgprint(
_('Healthcare Service Unit Type cannot be both <b>Allow Appointments</b> and <b>Inpatient Occupancy</b>'),
_('Healthcare Service Unit Type must allow atleast one among {0} and {1}').format(
frappe.bold('Allow Appointments'), frappe.bold('Inpatient Occupancy')),
raise_exception=1, title=_('Validation Error'), indicator='red'
)