update tracking code

master
SPP 2018-01-22 15:45:49 +07:00
parent aa2448888d
commit ac5ce1d1c8
3 changed files with 32 additions and 2 deletions

View File

@ -15,4 +15,5 @@ from . import clinic_setting
#from . import reimport10to15
#from . import add_missing_dlz # pending
#from . import validate_cycle_item
from . import update_line_amount
#from . import update_line_amount
#from . import fix_tracking

View File

@ -0,0 +1,30 @@
import csv
import xlrd
from netforce.model import get_model
from netforce import migration
from netforce.access import set_active_user, set_active_company
from netforce.database import get_connection
class Migration(migration.Migration):
_name="clinic.fix.tracking"
_version="2.12.5"
def migrate(self):
set_active_company(1)
set_active_user(1)
cond=[
['state','in',['waiting_payment','paid']],
]
for inv in get_model('account.invoice').search_browse(cond):
dpt=inv.department_id
branch=dpt.branch_id
track_id=branch_id.track_id.id
for line in inv.lines:
if line.track_id and line.track_id.id!=track_id:
line.write({
'track_id': track_id,
})
print("update tracking %s ... "%(inv.number))
Migration.register()

View File

@ -9,7 +9,6 @@ from netforce.database import get_connection
class Migration(migration.Migration):
_name="clinic.update.line.amount"
_version="2.12.5"
def migrate(self):
set_active_company(1)
set_active_user(1)