From 26441129bea6e18ca647375ef62ba3c0f4e5d189 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Mon, 23 Feb 2015 14:12:30 +0700 Subject: [PATCH] clean --- netforce_clinic/layouts/clinic_main_menu.xml | 2 +- netforce_clinic/layouts/clinic_menu.xml | 2 +- netforce_clinic/migrations/__init__.py | 4 +- netforce_clinic/migrations/import_acc.py | 92 ++++++-------------- netforce_clinic/models/labor_cost_line.py | 2 +- 5 files changed, 31 insertions(+), 71 deletions(-) diff --git a/netforce_clinic/layouts/clinic_main_menu.xml b/netforce_clinic/layouts/clinic_main_menu.xml index 828ae46..971ce22 100644 --- a/netforce_clinic/layouts/clinic_main_menu.xml +++ b/netforce_clinic/layouts/clinic_main_menu.xml @@ -1,5 +1,5 @@ - + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index e289f1a..34a71a4 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -1,4 +1,4 @@ - + diff --git a/netforce_clinic/migrations/__init__.py b/netforce_clinic/migrations/__init__.py index ff4c99e..8120743 100644 --- a/netforce_clinic/migrations/__init__.py +++ b/netforce_clinic/migrations/__init__.py @@ -1,4 +1,4 @@ from . import clinic_setting -#from . import import_acc +from . import import_acc #from . import remove_conv_bal -from . import update_labor_cost_line +#from . import update_labor_cost_line diff --git a/netforce_clinic/migrations/import_acc.py b/netforce_clinic/migrations/import_acc.py index 1344792..ef7c716 100644 --- a/netforce_clinic/migrations/import_acc.py +++ b/netforce_clinic/migrations/import_acc.py @@ -7,74 +7,34 @@ class Migration(migration.Migration): _version="2.11.0" def migrate(self): - #data={} - #lines=get_model("conv.bal").search_browse([]) - #for conv in lines: - #if conv.id==24: - #for invoice in conv.sale_invoices: - #amount_due=invoice.amount_due or 0 - #number=invoice.number or "" - #if not data.get(number): - #data[number]={'amount_due': amount_due} + cbv_id=24 + cbv=get_model("conv.bal").browse(cbv_id) + cbv.write({ + 'file': 'tb.csv', + }) + print("import acc file (step 1) running ...") + get_model("conv.bal").import_acc([cbv.id],context={}) - #f=open("/tmp/ar.csv","r") - #res=f.read().split("\n") - #total=0.0 - #del res[0] - #st="" - #no=1 - #for r in res: - #r=r.split(",") - #number=r[0] - #if not data.get(number): - #st+=','.join(r) - #st+='\n' - #print(no, 'XXX ', r) - #no+=1 - #f=open("res.csv","w") - #f.write(st) - #f.close() - #print("diff ", total) + cbv.write({ + 'file': 'ar.csv', + }) + print("import sale file (step 2)running ...") + get_model("conv.bal").import_sale_file([cbv.id],context={}) - #cbv_id=24 - #cbv=get_model("conv.bal").browse(cbv_id) - #cbv.write({ - #'file': 'tb.csv', - #}) - #print("import acc file (step 1) running ...") - #cbv.write({ - #'file': 'ar.csv', - #}) - #print("import sale file (step 2)running ...") - #get_model("conv.bal").import_sale_file([cbv.id],context={}) - #user_id=get_active_user() - #print("user_id ", user_id) - #set_active_user(1) - #cbv_id=24 - #print("create_open_entry...") - #cbv=get_model("conv.bal").browse(cbv_id) - #old={} - #for purchase in cbv.purch_invoices: - #number=purchase.number or '' - #print('number ', number) - #if not old.get(number): - #old.update({ - #'x': [number], - #}) - #else: - #x=old[number]['x'] - #number='%s.%s'%(number,len(x)) - #print('!!number ', number) - #purchase.write({ - #'number': number, - #}) - #x.append(number) - #cbv.create_open_entry() - #print("create_sale_invoices...") - #cbv.create_sale_invoices() - #print("create_purch_invoices...") - #cbv.create_purch_invoices() - #print("Done!") + print("import purch file (step 3) running ...") + cbv.write({ + 'file': 'ap.csv', + }) + get_model("conv.bal").import_purch([cbv.id],context={}) + + print("create invoice from setep 1 to 3 is running...") + print("create_open_entry...") + cbv.create_open_entry() + print("create_sale_invoices...") + cbv.create_sale_invoices() + print("create_purch_invoices...") + cbv.create_purch_invoices() + print("Done!") return True Migration.register() diff --git a/netforce_clinic/models/labor_cost_line.py b/netforce_clinic/models/labor_cost_line.py index 86733c5..21d947e 100644 --- a/netforce_clinic/models/labor_cost_line.py +++ b/netforce_clinic/models/labor_cost_line.py @@ -21,7 +21,7 @@ class LaborCostLine(Model): return res _fields={ - "labor_cost_id": fields.Many2One("clinic.labor.cost","Cycle Item",required=True,on_delete="cascade"), + "labor_cost_id": fields.Many2One("clinic.labor.cost","Labor Cost",required=True,on_delete="cascade"), "type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Staff Type",required=True,search=True,function="_get_store",function_multi=True), 'staff_id': fields.Many2One("clinic.staff", "Staff",search=True), 'level_id': fields.Many2One("clinic.staff.level", "Level",search=True),