clinic/netforce_clinic/migrations/import_acc.py

81 lines
2.4 KiB
Python
Raw Normal View History

from netforce.model import get_model
from netforce import migration
2015-02-18 16:53:29 +00:00
from netforce.access import set_active_user, get_active_user
class Migration(migration.Migration):
2015-02-12 08:52:35 +00:00
_name="import.acc"
2015-02-18 10:55:31 +00:00
_version="2.11.0"
def migrate(self):
2015-02-18 16:53:29 +00:00
#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}
2015-02-18 10:55:31 +00:00
2015-02-18 16:53:29 +00:00
#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)
2015-02-18 10:55:31 +00:00
#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={})
2015-02-18 16:53:29 +00:00
#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()
2015-02-21 13:38:21 +00:00
#print("create_purch_invoices...")
#cbv.create_purch_invoices()
#print("Done!")
return True
Migration.register()