From 0660116ec9d0e59060076844eb12bd986a4ea4cf Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Thu, 27 Nov 2014 14:36:27 +0700 Subject: [PATCH] xxxx --- .../layouts/clinic_cycle_monthly_form.xml | 8 +++++--- netforce_clinic/layouts/clinic_patient_form.xml | 1 + netforce_clinic/layouts/clinic_patient_list.xml | 1 + netforce_clinic/layouts/clinic_staff_list.xml | 2 +- netforce_clinic/models/cycle_daily.py | 13 ++++++++----- netforce_clinic/models/cycle_monthly.py | 6 ++---- netforce_clinic/models/patient.py | 5 +++-- netforce_clinic/models/schedule.py | 3 +++ 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/netforce_clinic/layouts/clinic_cycle_monthly_form.xml b/netforce_clinic/layouts/clinic_cycle_monthly_form.xml index 6ca0ce1..c5b1f55 100644 --- a/netforce_clinic/layouts/clinic_cycle_monthly_form.xml +++ b/netforce_clinic/layouts/clinic_cycle_monthly_form.xml @@ -7,9 +7,10 @@ - + + @@ -17,6 +18,7 @@
+ @@ -37,8 +39,8 @@ - - + + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 4445af6..43b6a3e 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -15,6 +15,7 @@ + diff --git a/netforce_clinic/layouts/clinic_patient_list.xml b/netforce_clinic/layouts/clinic_patient_list.xml index ad6d092..7668966 100644 --- a/netforce_clinic/layouts/clinic_patient_list.xml +++ b/netforce_clinic/layouts/clinic_patient_list.xml @@ -5,6 +5,7 @@ + diff --git a/netforce_clinic/layouts/clinic_staff_list.xml b/netforce_clinic/layouts/clinic_staff_list.xml index d1516a4..83ce722 100644 --- a/netforce_clinic/layouts/clinic_staff_list.xml +++ b/netforce_clinic/layouts/clinic_staff_list.xml @@ -1,8 +1,8 @@ - + diff --git a/netforce_clinic/models/cycle_daily.py b/netforce_clinic/models/cycle_daily.py index 24a971f..512fb3c 100644 --- a/netforce_clinic/models/cycle_daily.py +++ b/netforce_clinic/models/cycle_daily.py @@ -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', diff --git a/netforce_clinic/models/cycle_monthly.py b/netforce_clinic/models/cycle_monthly.py index 71f1976..26d4aca 100644 --- a/netforce_clinic/models/cycle_monthly.py +++ b/netforce_clinic/models/cycle_monthly.py @@ -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', } diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index 0ace877..f29971b 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -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']]) diff --git a/netforce_clinic/models/schedule.py b/netforce_clinic/models/schedule.py index eda6545..0dcd814 100644 --- a/netforce_clinic/models/schedule.py +++ b/netforce_clinic/models/schedule.py @@ -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():