conv_bal
watcha.h@almacom.co.th 2015-01-22 15:07:22 +07:00
parent 0a3357826a
commit 2323d058b9
7 changed files with 23 additions and 9 deletions

View File

@ -1,9 +1,10 @@
<form model="clinic.cycle.item.copy" title="Copy Nurses">
<group form_layout="stacked">
<field name="choice" onchange="onchange_choice" span="4"/>
<field name="item_copy_id" onchange="onchange_item" attrs='{"required":[["choice","=","item"]]}' span="4"/>
<field name="schd_copy_id" onchange="onchange_item" attrs='{"required":[["choice","=","schd"]]}' span="4"/>
<field name="item_copy_id" domain='[["department_id","=",department_id]]' onchange="onchange_item" attrs='{"required":[["choice","=","item"]]}' span="4"/>
<field name="schd_copy_id" domain='[["department_id","=",department_id]]' onchange="onchange_item" attrs='{"required":[["choice","=","schd"]]}' span="4"/>
<field name="cycle_item_id" span="2" invisible="1"/>
<field name="department_id" span="2" invisible="1"/>
</group>
<field name="lines" nolabel="1">
<list noadd="1">

View File

@ -4,7 +4,7 @@
<button string="Options" dropdown="1">
<!--<item string="Load Nurses" method="load_nurse_from_schedule" states='draft'/>-->
<item string="Copy Nurses" method="cycle_item_copy" states='draft'/>
<item string="Recheck HD Case" method="update_hdcase" states="draft" />
<item string="Recheck HD Case" method="update_hdcase" states="draft" confirm="Are you sure?"/>
<item string="View Schedule" method="view_schedule"/>
<item string="To Draft" method="to_draft" states="validated" />
</button>

View File

@ -8,5 +8,6 @@
<field name="branch_id"/>
<field name="nurse_total"/>
<field name="user_id"/>
<field name="date_validate"/>
<field name="state"/>
</list>

View File

@ -36,6 +36,7 @@ class CycleItem(Model):
_fields={
'name': fields.Char("Name",function="_get_store",function_multi=True,store=True),
'date': fields.Date("Date",search=True),
'date_validate': fields.DateTime("Date Validate"),
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True),
'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"),
'hd_cases': fields.One2Many("clinic.hd.case","cycle_item_id", "HD Cases"),
@ -47,7 +48,7 @@ class CycleItem(Model):
'department_id': fields.Many2One("clinic.department", "Department",search=True),
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
"state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True),
'nurse_total': fields.Integer("Total (Nurse)",function="_get_all",function_multi=True),
'nurse_total': fields.Integer("Nurses",function="_get_all",function_multi=True),
}
def _get_branch(self,context={}):
@ -113,6 +114,7 @@ class CycleItem(Model):
lc.compute()
obj.write({
'state': 'validated',
'date_validate': time.strftime("%Y-%m-%d %H:%M:%S"),
})
return {

View File

@ -9,6 +9,7 @@ class CycleItemCopy(Model):
'choice': fields.Selection([['item','Cycle Item'],['schd','Schedule']],'Choice'),
"item_copy_id": fields.Many2One("clinic.cycle.item","Cycle Item"),
"schd_copy_id": fields.Many2One("clinic.schedule","Schedule"),
'department_id': fields.Many2One("clinic.department","Department"),
'lines': fields.One2Many("clinic.cycle.item.copy.line","item_copy_id","Lines"),
}
@ -18,8 +19,18 @@ class CycleItemCopy(Model):
return None
return int(refer_id)
def _get_department(self,context={}):
refer_id=context.get("refer_id")
if not refer_id:
return None
item=get_model('clinic.cycle.item').browse(int(refer_id))
dpt=item.department_id
print('dpt ', dpt.id)
return dpt.id
_defaults={
'cycle_item_id': _get_cycle_item_id,
'department_id': _get_department,
'choice': 'item',
}

View File

@ -230,6 +230,7 @@ class Schedule(Model):
def create(self,vals,**kw):
id=super().create(vals,**kw)
self.function_store([id])
return id
def write(self,ids,vals,**kw):
super().write(ids,vals,**kw)

View File

@ -91,12 +91,10 @@ class ClinicSetting(Model):
return True
def run_script(self,ids,context={}):
db=get_connection
for item in get_model("clinic.cycle.item").search_browse([]):
for line in item.lines:
nr=line.nurse_id
line.write({
'state': nr.state,
})
res=db.query('select create_time from clinic_cycle_item')
print(res)
print("Done!")
def reset_last_import(self,ids,context={}):