clinic/netforce_clinic/migrations/import_acc.py

40 lines
1.2 KiB
Python

from netforce.model import get_model
from netforce import migration
from netforce.access import set_active_user, get_active_user
class Migration(migration.Migration):
_name="import.acc"
_version="2.11.0"
def migrate(self):
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={})
cbv.write({
'file': 'ar.csv',
})
print("import sale file (step 2)running ...")
get_model("conv.bal").import_sale_file([cbv.id],context={})
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()