conv_bal
watcha.h 2014-11-27 14:36:27 +07:00
parent 5673bc37f2
commit 0660116ec9
8 changed files with 24 additions and 15 deletions

View File

@ -7,9 +7,10 @@
</head>
<tabs>
<tab string="General">
<field name="month" mode="month"/>
<field name="name"/>
<field name="lines" nolabel="1">
<list>
<field name="date"/>
<field name="staff_id"/>
<field name="level_id"/>
<field name="type"/>
@ -17,6 +18,7 @@
<field name="amount"/>
</list>
<form>
<field name="date"/>
<field name="staff_id"/>
<field name="level_id"/>
<field name="type"/>
@ -37,8 +39,8 @@
</foot>
<related>
<field name="cycle_dailies">
<list colors='{"#cfc":[["state","=","done"]]}'>
<field name="cycle_daily_id"/>
<list colors='{"#cfc":[["state","=","confirmed"]]}'>
<field name="name"/>
<field name="date"/>
<field name="state"/>
</list>

View File

@ -15,6 +15,7 @@
<field name="partner_id"/>
<field name="categ_id"/>
<field name="doctor_id"/>
<field name="department_id"/>
<field name="branch_id"/>
<tabs>
<tab string="General Information">

View File

@ -5,6 +5,7 @@
<field name="number"/>
<field name="hn"/>
<field name="name"/>
<field name="department_id"/>
<field name="branch_id"/>
<field name="reg_date"/>
<!--<field name="resign_date"/>-->

View File

@ -1,8 +1,8 @@
<list model="clinic.staff">
<field name="number"/>
<field name="name"/>
<field name="branch_id"/>
<field name="department_id"/>
<field name="branch_id"/>
<field name="level_id"/>
<field name="categ_id"/>
<field name="type"/>

View File

@ -51,8 +51,6 @@ class CycleDaily(Model):
obj.write({
'state': 'confirmed',
})
# TODO create/update cycle monthly
all_vals={}
for line in obj.lines:
staff=line.staff_id
@ -74,10 +72,9 @@ class CycleDaily(Model):
vals.update({'staff_id': staff_id})
lines.append(('create',vals))
m=int(obj.date[5:7])
db=get_connection()
res=db.query("select id from clinic_cycle_monthly where extract(month from month)=%s"%m)
mname=obj.date[0:7].replace("-","/")
mobj=get_model("clinic.cycle.monthly")
res=mobj.search_browse([['name','=',mname]])
mid=None
monthly=None
if res:
@ -91,11 +88,17 @@ class CycleDaily(Model):
})
else:
mid=mobj.create({
'name': mname,
'lines': lines,
})
monthly=mobj.browse(mid)
if not monthly:
return
obj.write({
'cycle_monthly_id': mid,
})
return {
'next': {
'name': 'clinic_cycle_monthly',

View File

@ -21,8 +21,7 @@ class CycleMonthly(Model):
_fields={
"name": fields.Char("Name"),
'month': fields.Date("Month", required=True, search=True),
'cycle_dailies': fields.One2Many("clinic.cycle.daily","cycle_monthly_id", "Cycle Dialies"),
'cycle_dailies': fields.One2Many("clinic.cycle.daily","cycle_monthly_id", "Cycle Dialy"),
'lines': fields.One2Many("clinic.cycle.monthly.line","cycle_monthly_id", "Lines"),
'company_id': fields.Many2One("company","Company"),
'total': fields.Float("Total",function="_get_all", function_multi=True),
@ -32,8 +31,7 @@ class CycleMonthly(Model):
_defaults={
'company_id': lambda *a: get_active_company(),
'month': lambda *a: time.strftime("%Y-%m-%d"),
'name': lambda *a: time.strftime("%Y-%m-%d"),
'name': lambda *a: time.strftime("%Y/%m"),
'user_id': lambda *a: get_active_user(),
'state': 'draft',
}

View File

@ -83,6 +83,7 @@ class Patient(Model):
'resign_date': fields.Date("Resign Date"),
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'department_id': fields.Many2One("clinic.department","Department"),
}
def _get_number(self,context={}):
@ -176,7 +177,7 @@ class Patient(Model):
'address2': 'your address2',
'city': 'your city',
'postal_code': 'your zip',
'country_id': 1, #XXX
'country_id': 1,
})
get_model('address').browse(address_id).write({
@ -231,7 +232,7 @@ class Patient(Model):
'partner_id': partner_id,
})
del vals['addresses']
print("create address for %s"%obj.name)
print("create address for %s"%obj.name, ' ', addr_vals)
if obj.rm_remain_visit:
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']])

View File

@ -149,6 +149,9 @@ class Schedule(Model):
'nurse_id': nurse.id,
'level_id': nurse.level_id.id,
}))
line.write({
'cycle_item_id': item_id,
})
cycles.update({cycle.name})
for item_id, nurses in items.items():