27 lines
864 B
Python
27 lines
864 B
Python
|
from netforce.model import get_model
|
||
|
from netforce import migration
|
||
|
from netforce.access import set_active_user, set_active_company
|
||
|
|
||
|
class Migration(migration.Migration):
|
||
|
_name="clinic.repos.invoice"
|
||
|
_version="2.10.0"
|
||
|
|
||
|
def migrate(self):
|
||
|
set_active_user(1)
|
||
|
set_active_company(1)
|
||
|
for hdcase in get_model('clinic.hd.case').search_browse([]):
|
||
|
for inv in hdcase.invoices:
|
||
|
if inv.state=='waiting_payment':
|
||
|
print('repost ---> ', inv.number)
|
||
|
inv.to_draft()
|
||
|
inv.post()
|
||
|
print("Done!")
|
||
|
for shop in get_model('clinic.shop').search_browse([]):
|
||
|
for inv in shop.invoices:
|
||
|
print('repost ---> ', inv.number)
|
||
|
inv.to_draft()
|
||
|
inv.post()
|
||
|
return True
|
||
|
|
||
|
Migration.register()
|