conv_bal
watcha.h 2015-02-18 17:55:31 +07:00
parent 18d2628bf1
commit 8a16157c61
2 changed files with 46 additions and 20 deletions

View File

@ -3,20 +3,49 @@ from netforce import migration
class Migration(migration.Migration): class Migration(migration.Migration):
_name="import.acc" _name="import.acc"
_version="2.10.0" _version="2.11.0"
def migrate(self): def migrate(self):
cbv_id=24 data={}
cbv=get_model("conv.bal").browse(cbv_id) lines=get_model("conv.bal").search_browse([])
cbv.write({ for conv in lines:
'file': 'tb.csv', if conv.id==24:
}) for invoice in conv.sale_invoices:
print("import acc file (step 1) running ...") amount_due=invoice.amount_due or 0
cbv.write({ number=invoice.number or ""
'file': 'ar.csv', if not data.get(number):
}) data[number]={'amount_due': amount_due}
print("import sale file (step 2)running ...")
get_model("conv.bal").import_sale_file([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_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={})
return True return True
Migration.register() Migration.register()

View File

@ -1,10 +1,7 @@
todo: todo:
- checking douplicate name --------
- matching payment *** matching payment
- script generate hd case
- report doctor & nurse ***
- summary -> ok -------
- detail -> ok
- daily -> ok
but not link yet