2015-08-04 11:05:31 +00:00
|
|
|
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,
|
|
|
|
})
|
2015-08-04 11:24:37 +00:00
|
|
|
if payment.move_id:
|
|
|
|
for line in payment.move_id.lines:
|
|
|
|
line.write({
|
|
|
|
'track_id': track_id,
|
|
|
|
})
|
2015-08-04 11:05:31 +00:00
|
|
|
for invoice in hdcase.invoices:
|
|
|
|
for line in invoice.lines:
|
|
|
|
line.write({
|
|
|
|
'track_id': track_id,
|
|
|
|
})
|
2015-08-04 11:24:37 +00:00
|
|
|
if invoice.move_id:
|
|
|
|
for line in invoice.move_id.lines:
|
|
|
|
line.write({
|
|
|
|
'track_id': track_id,
|
|
|
|
})
|
2015-08-04 11:05:31 +00:00
|
|
|
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,
|
|
|
|
})
|
2015-08-04 11:24:37 +00:00
|
|
|
if payment.move_id:
|
|
|
|
for line in payment.move_id.lines:
|
|
|
|
line.write({
|
|
|
|
'track_id': track_id,
|
|
|
|
})
|
2015-08-04 11:05:31 +00:00
|
|
|
for invoice in hdcase.invoices:
|
|
|
|
for line in invoice.lines:
|
|
|
|
line.write({
|
|
|
|
'track_id': track_id,
|
|
|
|
})
|
2015-08-04 11:24:37 +00:00
|
|
|
if invoice.move_id:
|
|
|
|
for line in invoice.move_id.lines:
|
|
|
|
line.write({
|
|
|
|
'track_id': track_id,
|
|
|
|
})
|
2015-08-04 11:05:31 +00:00
|
|
|
|
|
|
|
Migration.register()
|