migrate hdcase number
parent
6e1a489ba4
commit
6177a247ad
|
@ -5,4 +5,5 @@
|
||||||
#from . import check_seq
|
#from . import check_seq
|
||||||
#from . import del_gi
|
#from . import del_gi
|
||||||
#from . import restore_picking
|
#from . import restore_picking
|
||||||
from . import rename_dbl_hdcase_number
|
#from . import rename_dbl_hdcase_number
|
||||||
|
from . import reset_hdcase_number
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
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.rename.dbl.hdcase.number"
|
||||||
|
_version="2.12.2"
|
||||||
|
|
||||||
|
def migrate(self):
|
||||||
|
set_active_company(1)
|
||||||
|
set_active_user(1)
|
||||||
|
datenow=time.strftime("%Y-%m-%d")
|
||||||
|
dom=[
|
||||||
|
['date','>=',datenow],
|
||||||
|
['date','<=',datenow],
|
||||||
|
]
|
||||||
|
for hdcase in get_model("clinic.hd.case").search_browse(dom):
|
||||||
|
nums=hdcase.number.split("-")
|
||||||
|
if len(nums)==3 and len(nums[2])==6:
|
||||||
|
run=nums[2]
|
||||||
|
number='-'.join([nums[0],nums[1]+run[0:2],run[2:]])
|
||||||
|
print('XXX', hdcase.number, ' --> ', number)
|
||||||
|
hdcase.write({
|
||||||
|
'number': number,
|
||||||
|
})
|
||||||
|
|
||||||
|
Migration.register()
|
Loading…
Reference in New Issue