clinic/netforce_clinic/migrations/import_acc.py

40 lines
1.2 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-23 07:12:30 +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 ...")
get_model("conv.bal").import_acc([cbv.id],context={})
2015-02-18 10:55:31 +00:00
2015-02-23 07:12:30 +00:00
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 10:55:31 +00:00
2015-02-23 07:12:30 +00:00
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()