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

@ -1,5 +1,6 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0, "allow_guest_to_view": 0,
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
@ -329,26 +330,26 @@
"columns": 0, "columns": 0,
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 0,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 1,
"in_standard_filter": 0, "in_standard_filter": 1,
"label": "Company", "label": "Company",
"length": 0, "length": 0,
"no_copy": 1, "no_copy": 0,
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 1, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 1,
"report_hide": 1, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 1,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
@ -461,7 +462,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-08-08 12:57:12.709806", "modified": "2018-10-04 21:09:52.261882",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Healthcare Service Unit", "name": "Healthcare Service Unit",

View File

@ -5,10 +5,19 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.utils.nestedset import NestedSet from frappe.utils.nestedset import NestedSet
import frappe
class HealthcareServiceUnit(NestedSet): class HealthcareServiceUnit(NestedSet):
nsm_parent_field = 'parent_healthcare_service_unit' 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): def on_update(self):
super(HealthcareServiceUnit, self).on_update() super(HealthcareServiceUnit, self).on_update()
self.validate_one_root() self.validate_one_root()