59 lines
2.1 KiB
Python
59 lines
2.1 KiB
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.update.account.tracking"
|
|
_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([]):
|
|
track_id=hdcase.branch_id.track_id.id
|
|
for payment in hdcase.payments:
|
|
for line in payment.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
if payment.move_id:
|
|
for line in payment.move_id.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
for invoice in hdcase.invoices:
|
|
for line in invoice.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
if invoice.move_id:
|
|
for line in invoice.move_id.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
for shop in get_model('clinic.shop').search_browse([]):
|
|
track_id=shop.branch_id.track_id.id
|
|
for payment in hdcase.payments:
|
|
for line in payment.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
if payment.move_id:
|
|
for line in payment.move_id.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
for invoice in hdcase.invoices:
|
|
for line in invoice.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
if invoice.move_id:
|
|
for line in invoice.move_id.lines:
|
|
line.write({
|
|
'track_id': track_id,
|
|
})
|
|
|
|
Migration.register()
|