store patient_name on hdcase

revise1
SPP 2017-11-23 13:44:38 +07:00
parent 57baccb9ef
commit 75a194178c
6 changed files with 38 additions and 6 deletions

View File

@ -113,8 +113,13 @@
</group>
</tab>
<tab string="Other">
<field name="nurse_id" span="4"/>
<field name="check_dlz" span="4"/>
<group span="6" columns="1">
<field name="patient_name"/>
<field name="nurse_id"/>
<field name="check_dlz"/>
</group>
<group span="6" columns="1">
</group>
<!--<field name="fee_partner_id" span="4" domain="[['type','=','org']]"/>-->
</tab>
</tabs>

View File

@ -2,7 +2,8 @@
<field name="number"/>
<field name="date"/>
<field name="cycle_id"/>
<field name="patient_id"/>
<!--<field name="patient_id"/>-->
<field name="patient_name"/>
<field name="patient_type_id"/>
<field name="epo"/>
<field name="department_id"/>

View File

@ -2,7 +2,8 @@
<field name="number"/>
<field name="date"/>
<field name="cycle_id"/>
<field name="patient_id"/>
<!--<field name="patient_id"/>-->
<field name="patient_name"/>
<field name="patient_type_id"/>
<field name="department_id"/>
<field name="branch_id"/>

View File

@ -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

View File

@ -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()

View File

@ -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