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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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