conv_bal
watcha.h 2014-12-04 09:52:49 +07:00
parent c814e08ad5
commit 9e9603eca9
4 changed files with 25 additions and 12 deletions

View File

@ -76,8 +76,23 @@
<field name="note"/> <field name="note"/>
</list> </list>
</field> </field>
<field name="hd_case_staffs">
<list>
<field name="hd_case_id"/>
</list>
<form>
<field name="hd_case_id"/>
</form>
</field>
<field name="cycle_item_nurses">
<list>
<field name="cycle_item_id"/>
</list>
<form>
<field name="cycle_item_id"/>
</form>
</field>
<field name="patients"/> <field name="patients"/>
<field name="hd_cases"/>
<field name="comments"/> <field name="comments"/>
</related> </related>
</form> </form>

View File

@ -51,6 +51,7 @@ class CycleItem(Model):
'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"), 'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"),
'hd_cases': fields.One2Many("clinic.hd.case","cycle_item_id", "HD Cases"), 'hd_cases': fields.One2Many("clinic.hd.case","cycle_item_id", "HD Cases"),
'nurses': fields.One2Many("clinic.cycle.item.nurse",'cycle_item_id','Nurses'), 'nurses': fields.One2Many("clinic.cycle.item.nurse",'cycle_item_id','Nurses'),
'nurse_id': fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]), #XXX
'sequence': fields.Char("Sequence"), # for sort item 'sequence': fields.Char("Sequence"), # for sort item
'company_id': fields.Many2One("company", "Company"), 'company_id': fields.Many2One("company", "Company"),
"state": fields.Selection([("draft","Draft"),("done","Done")],"Status",required=True), "state": fields.Selection([("draft","Draft"),("done","Done")],"Status",required=True),

View File

@ -81,7 +81,7 @@ class HDCase(Model):
"patient_type": fields.Char("Service Type",function="_get_patient_type"), "patient_type": fields.Char("Service Type",function="_get_patient_type"),
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."), "vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]), "nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
"staff_id": fields.Many2One("clinic.staff", "Staff"), "staff_id": fields.Many2One("clinic.staff", "Staff"), #XXX
"department_id": fields.Many2One("clinic.department", "Department",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True),
"wt_kg": fields.Float("Wt.kg."), "wt_kg": fields.Float("Wt.kg."),
"bp": fields.Integer("BP"), "bp": fields.Integer("BP"),
@ -94,6 +94,7 @@ class HDCase(Model):
"dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"), "dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"), "lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
"staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"), "staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"),
"staff_id": fields.Many2One("clinic.hd.case.staff","Staff"), #XXX
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"), "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
"reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True), "reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True),
"invoices": fields.One2Many("account.invoice","related_id","Invoices"), "invoices": fields.One2Many("account.invoice","related_id","Invoices"),
@ -826,9 +827,9 @@ class HDCase(Model):
st=get_model("clinic.setting").browse(1) st=get_model("clinic.setting").browse(1)
for pl in st.invoice_policies: for pl in st.invoice_policies:
policy=pl.invoice_policy policy=pl.invoice_policy
patient_type=pl.patient_type patient_type_id=pl.patient_type_id.id
opt=pl.invoice_option opt=pl.invoice_option
if patient.type==patient_type: if patient.type_id.id==patient_type_id:
vals['invoice_policy']=policy vals['invoice_policy']=policy
vals['invoice_option']=opt vals['invoice_option']=opt
break break
@ -843,15 +844,10 @@ class HDCase(Model):
def write(self,ids,vals,**kw): def write(self,ids,vals,**kw):
patient_id=vals.get('patient_id') patient_id=vals.get('patient_id')
# XXX import problem # XXX importing problem
# when change patient # when change patient
#vals=self.get_staff_line(vals,patient_id) #vals=self.get_staff_line(vals,patient_id)
vals=self.get_invoice_policy(vals,patient_id) vals=self.get_invoice_policy(vals,patient_id)
obj=self.browse(ids)[0]
for st in obj.staffs:
if st.type=='doctor':
doctor=st.staff_id
vals['staff_id']=doctor.id
super().write(ids,vals,**kw) super().write(ids,vals,**kw)
def onchange_type(self,context={}): def onchange_type(self,context={}):

View File

@ -54,6 +54,7 @@ class Staff(Model):
} }
return res return res
_fields={ _fields={
'employee_id': fields.Many2One("hr.employee","Employee"), 'employee_id': fields.Many2One("hr.employee","Employee"),
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),
@ -81,7 +82,6 @@ class Staff(Model):
"comments": fields.One2Many("message","related_id","Comments"), "comments": fields.One2Many("message","related_id","Comments"),
"nurse_visits": fields.One2Many("clinic.visit","nurse_id","Visits"), "nurse_visits": fields.One2Many("clinic.visit","nurse_id","Visits"),
"doctor_visits": fields.One2Many("clinic.visit","doctor_id","Visits"), "doctor_visits": fields.One2Many("clinic.visit","doctor_id","Visits"),
"hd_cases": fields.One2Many("clinic.hd.case","staff_id","HD Cases"),
"company_id": fields.Many2One("company","Company"), "company_id": fields.Many2One("company","Company"),
"user_id": fields.Many2One("base.user","User"), "user_id": fields.Many2One("base.user","User"),
'picture': fields.File("Picture"), 'picture': fields.File("Picture"),
@ -100,6 +100,8 @@ class Staff(Model):
"cycles": fields.One2Many("clinic.staff.cycle","staff_id","Cycles"), "cycles": fields.One2Many("clinic.staff.cycle","staff_id","Cycles"),
'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"), 'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"),
'branch_id': fields.Many2One("clinic.branch","Branch"), 'branch_id': fields.Many2One("clinic.branch","Branch"),
"hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"),
"cycle_item_nurses": fields.One2Many("clinic.cycle.item.nurse","nurse_id","Cycle Items"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -121,7 +123,6 @@ class Staff(Model):
_defaults={ _defaults={
'active': True, 'active': True,
"state": "temporary", "state": "temporary",
#'type': 'staff',
"type": lambda self,ctx: ctx.get("type") or "staff", "type": lambda self,ctx: ctx.get("type") or "staff",
"date": lambda *a: time.strftime("%Y-%m-%d"), "date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number, "number": _get_number,