diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml index 7eddc49..2576196 100644 --- a/netforce_clinic/layouts/clinic_hd_case_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_form.xml @@ -113,8 +113,13 @@ - - + + + + + + + diff --git a/netforce_clinic/layouts/clinic_hd_case_list.xml b/netforce_clinic/layouts/clinic_hd_case_list.xml index 92bb743..ba87dae 100644 --- a/netforce_clinic/layouts/clinic_hd_case_list.xml +++ b/netforce_clinic/layouts/clinic_hd_case_list.xml @@ -2,7 +2,8 @@ - + + diff --git a/netforce_clinic/layouts/clinic_hd_case_search.xml b/netforce_clinic/layouts/clinic_hd_case_search.xml index 5acd5a9..4de426f 100644 --- a/netforce_clinic/layouts/clinic_hd_case_search.xml +++ b/netforce_clinic/layouts/clinic_hd_case_search.xml @@ -2,7 +2,8 @@ - + + diff --git a/netforce_clinic/migrations/__init__.py b/netforce_clinic/migrations/__init__.py index d5e40e0..c870ecf 100644 --- a/netforce_clinic/migrations/__init__.py +++ b/netforce_clinic/migrations/__init__.py @@ -16,3 +16,4 @@ from . import clinic_setting #from . import add_missing_dlz # pending #from . import validate_cycle_item from . import update_line_amount +from . import revise diff --git a/netforce_clinic/migrations/revise.py b/netforce_clinic/migrations/revise.py new file mode 100644 index 0000000..07a536e --- /dev/null +++ b/netforce_clinic/migrations/revise.py @@ -0,0 +1,21 @@ +import csv +import xlrd + +from netforce.model import get_model +from netforce import migration +from netforce.access import set_active_user, set_active_company +from netforce.database import get_connection + +class Migration(migration.Migration): + _name="clinic.revise" + _version="2.12.6" + + def migrate(self): + set_active_user(1) + for hdcase in get_model('clinic.hd.case').search_browse([]): + if not hdcase.patient_name and hdcase.patient_id: + hdcase.write({ + 'patient_name': hdcase.patient_id.name_get()[-1][1], + }) + +Migration.register() diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 1d65184..914fc82 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -298,6 +298,8 @@ class HDCase(Model): 'company_id': fields.Many2One("company","Company"), 'branch_id': fields.Many2One("clinic.branch","Branch"), 'check_dlz': fields.Boolean("Check Dialyzer"), + #revise + 'patient_name': fields.Char("Patient Name", search=True), } def _get_number(self,context={}): @@ -409,6 +411,7 @@ class HDCase(Model): data['branch_id']=branch.id data['cycle_id']=cycle.id data['patient_type_id']=patient.type_id.id + data['patient_name']=patient.name_get()[-1][1] data['type_code']=patient.type_id.code if patient.type_id.hct_include: data['hct_include']=True @@ -437,7 +440,6 @@ class HDCase(Model): 'price': pline.price or 0, 'amount': pline.amount or 0, }) - return data def onchange_line(self,context={}): @@ -1572,13 +1574,14 @@ class HDCase(Model): def create(self,vals,context): patient_id=vals['patient_id'] + patient=get_model("clinic.patient").browse(patient_id) if 'vascular_acc' in vals.keys(): - patient=get_model("clinic.patient").browse(patient_id) patient.write({ 'vascular_acc': vals['vascular_acc'] }) vals=self.get_staff_line(vals,patient_id) vals=self.get_hct(vals,patient_id) + vals['patient_name']=patient.name_get()[-1][1] new_id=super().create(vals,context=context) self.function_store([new_id]) return new_id