clinic/netforce_clinic/models/setting_account_patient.py

25 lines
1.1 KiB
Python
Raw Permalink Normal View History

2015-03-04 07:42:18 +00:00
from netforce.model import Model, fields
2015-04-05 12:35:17 +00:00
from netforce.access import get_active_company
2015-03-04 07:42:18 +00:00
class SettingAccountPatient(Model):
_name="clinic.setting.account.patient"
2015-03-11 10:08:42 +00:00
_string="Account Patient"
2015-03-04 07:42:18 +00:00
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting",required=True,on_delete="cascade"),
"patient_id": fields.Many2One("clinic.patient","Patient",domain=[["state","=","admit"]], search=True,required=True),
'partner_id': fields.Many2One("partner","Contact", search=True,required=True),
'type_id': fields.Many2One("clinic.patient.type","Type", search=True,required=True),
2015-04-05 12:35:17 +00:00
'hn': fields.Char("HN", search=True),
'card_no': fields.Char("ID Card",size=13, search=True),
'company_id': fields.Many2One("company","Company"),
}
_defaults={
'setting_id': 1,
"company_id": lambda *a: get_active_company(),
2015-03-04 07:42:18 +00:00
}
_sql_constraints=("clinic_setting_acc_pt_key_uniq","unique(patient_id,partner_id,type_id,hn,card_no)","account patient should be unique"),
2015-03-04 07:42:18 +00:00
_order="type_id,patient_id"
SettingAccountPatient.register()