Healthcare Service Unit - added company abbr as suffix (#15590)

This commit is contained in:
Jamsheer 2018-10-05 11:38:15 +05:30 committed by Rushabh Mehta
parent dc2bab2b72
commit be6e426fe0
2 changed files with 512 additions and 502 deletions

View File

@ -5,10 +5,19 @@
from __future__ import unicode_literals
from frappe.utils.nestedset import NestedSet
import frappe
class HealthcareServiceUnit(NestedSet):
nsm_parent_field = 'parent_healthcare_service_unit'
def autoname(self):
if self.company:
suffix = " - " + frappe.get_cached_value('Company', self.company, "abbr")
if not self.healthcare_service_unit_name.endswith(suffix):
self.name = self.healthcare_service_unit_name + suffix
else:
self.name = self.healthcare_service_unit_name
def on_update(self):
super(HealthcareServiceUnit, self).on_update()
self.validate_one_root()