|
@ -24,7 +24,7 @@ def pre_init_hook_for_submodules(cr, model, field): |
|
|
with cr.savepoint(): |
|
|
with cr.savepoint(): |
|
|
table = env[model]._table |
|
|
table = env[model]._table |
|
|
column_exists = table_has_column(cr, table, field) |
|
|
column_exists = table_has_column(cr, table, field) |
|
|
# Extract the binary content directly from the table |
|
|
|
|
|
|
|
|
# fields.Binary(), extract the binary content directly from the table |
|
|
if column_exists: |
|
|
if column_exists: |
|
|
extract_query = """ |
|
|
extract_query = """ |
|
|
SELECT id, %%s, 'db', %(field)s |
|
|
SELECT id, %%s, 'db', %(field)s |
|
@ -32,7 +32,7 @@ def pre_init_hook_for_submodules(cr, model, field): |
|
|
WHERE %(field)s IS NOT NULL |
|
|
WHERE %(field)s IS NOT NULL |
|
|
""" % {"table": table, "field": field} |
|
|
""" % {"table": table, "field": field} |
|
|
image_field = 'file_db_store' |
|
|
image_field = 'file_db_store' |
|
|
# Extract the binary content from the ir_attachment table |
|
|
|
|
|
|
|
|
# fields.Binary(attachment=True), get the ir_attachment record ID |
|
|
else: |
|
|
else: |
|
|
extract_query = """ |
|
|
extract_query = """ |
|
|
SELECT res_id, res_model, 'filestore', id |
|
|
SELECT res_id, res_model, 'filestore', id |
|
@ -40,8 +40,6 @@ def pre_init_hook_for_submodules(cr, model, field): |
|
|
WHERE res_field='%(field)s' AND res_model='%(model)s' |
|
|
WHERE res_field='%(field)s' AND res_model='%(model)s' |
|
|
""" % {"model": model, "field": field} |
|
|
""" % {"model": model, "field": field} |
|
|
image_field = 'attachment_id' |
|
|
image_field = 'attachment_id' |
|
|
|
|
|
|
|
|
cr.execute(extract_query) |
|
|
|
|
|
cr.execute( |
|
|
cr.execute( |
|
|
""" |
|
|
""" |
|
|
INSERT INTO base_multi_image_image ( |
|
|
INSERT INTO base_multi_image_image ( |
|
|