You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted #2501
Impacted versions: OpenUpgrade 13
Steps to reproduce: Run migration from 12 to 13
Current behavior: Until a certain point, the migration goes normal until the error occurs
Expected behavior: End the migration
Detail of the error:
ERROR bdxxx OpenUpgrade: product: error in migration script product/migrations/13.0.1.2/post-migration.py: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None) ERROR bdxxx OpenUpgrade: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None) Traceback (most recent call last): File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get value = self._data[field][record._ids[0]] KeyError: 1021
what is the product # 1021 in V12 ? is it a special product with an xml_id ?
thanks.
@legalsylvain
Thank you very much for the answer, below you have the complete output and metadata of the related product in V12: ID: 1021 XML ID: / No update: false Creation User: Beatriz Rocha Creation date: 09/19/2019 12:10:34 Last Modified by: System Last Date Modified: 09/21/2020 4:16:19 PM
2021-01-21 19:22:10,578 2537 DEBUG bdxxx OpenUpgrade: 285 rows affected after 0:00:00.061979 running
UPDATE product_template_attribute_value ptav
SET attribute_line_id = ptal.id
FROM product_template_attribute_line ptal
JOIN product_template pt ON ptal.product_tmpl_id = pt.id
JOIN product_attribute_value_product_template_attribute_line_rel
avtalr ON avtalr.product_template_attribute_line_id = ptal.id
WHERE ptal.active = TRUE AND ptav.product_tmpl_id = pt.id AND
ptav.product_attribute_value_id = avtalr.product_attribute_value_id
2021-01-21 19:22:10,656 2537 DEBUG bdxxx OpenUpgrade: 285 rows affected after 0:00:00.077993 running
UPDATE product_template_attribute_value ptav
SET attribute_id = ptal.attribute_id
FROM product_template_attribute_line ptal
WHERE ptav.attribute_line_id = ptal.id
2021-01-21 19:22:10,669 2537 DEBUG bdxxx OpenUpgrade: 13 rows affected after 0:00:00.012696 running
INSERT INTO product_variant_combination
(product_product_id, product_template_attribute_value_id)
SELECT pavppr.product_product_id, ptav.id
FROM product_attribute_value_product_product_rel pavppr
JOIN product_product pp
ON pp.id = pavppr.product_product_id
JOIN product_template_attribute_value ptav
ON ptav.product_attribute_value_id = pavppr.product_attribute_value_id
AND pp.product_tmpl_id = ptav.product_tmpl_id
2021-01-21 19:22:10,669 2537 INFO bdxxx OpenUpgrade: product: loading migrations/13.0.1.2/noupdate_changes.xml
2021-01-21 19:22:12,478 2537 ERROR bdxxx OpenUpgrade: product: error in migration script product/migrations/13.0.1.2/post-migration.py: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,478 2537 ERROR bdxxx OpenUpgrade: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get
value = self._data[field][record._ids[0]]
KeyError: 1021
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/fields.py", line 1004, in get
value = env.cache.get(record, self)
File "/odoo/OpenUpgrade/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('product.product(1021,).product_tmpl_id', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/openupgradelib-3.0.0-py3.8.egg/openupgradelib/openupgrade.py", line 1870, in wrapped_function
func(
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 71, in migrate
convert_image_attachments(env)
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 61, in convert_image_attachments
Model.browse(attachment.res_id).image_1920 = attachment.datas
File "/odoo/OpenUpgrade/odoo/fields.py", line 1089, in set
records.write({self.name: write_value})
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 330, in write
res = super(ProductProduct, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_thread.py", line 323, in write
result = super(MailThread, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_activity.py", line 726, in write
return super(MailActivityMixin, self).write(vals)
File "/odoo/OpenUpgrade/odoo/models.py", line 3635, in write
fields[0].determine_inverse(real_recs)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1122, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 160, in _set_image_1920
record.image_1920 and not record.product_tmpl_id.image_1920 or
File "/odoo/OpenUpgrade/odoo/fields.py", line 2333, in get
return super().get(records, owner)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1015, in get
raise MissingError("\n".join([
odoo.exceptions.MissingError: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,487 2537 ERROR bdxxx odoo.modules.loading: Error executing post migration script for module product
`-> stock
: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,501 2537 WARNING bdxxx odoo.modules.loading: Transient module states were reset
2021-01-21 19:22:12,504 2537 ERROR bdxxx odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get
value = self._data[field][record._ids[0]]
KeyError: 1021
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/fields.py", line 1004, in get
value = env.cache.get(record, self)
File "/odoo/OpenUpgrade/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('product.product(1021,).product_tmpl_id', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 477, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 360, in load_marked_modules
loaded, processed = load_module_graph(
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 256, in load_module_graph
migrations.migrate_module(package, 'post')
File "/odoo/OpenUpgrade/odoo/modules/migration.py", line 185, in migrate_module
migrate(self.cr, installed_version)
File "/usr/local/lib/python3.8/dist-packages/openupgradelib-3.0.0-py3.8.egg/openupgradelib/openupgrade.py", line 1870, in wrapped_function
func(
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 71, in migrate
convert_image_attachments(env)
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 61, in convert_image_attachments
Model.browse(attachment.res_id).image_1920 = attachment.datas
File "/odoo/OpenUpgrade/odoo/fields.py", line 1089, in set
records.write({self.name: write_value})
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 330, in write
res = super(ProductProduct, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_thread.py", line 323, in write
result = super(MailThread, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_activity.py", line 726, in write
return super(MailActivityMixin, self).write(vals)
File "/odoo/OpenUpgrade/odoo/models.py", line 3635, in write
fields[0].determine_inverse(real_recs)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1122, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 160, in _set_image_1920
record.image_1920 and not record.product_tmpl_id.image_1920 or
File "/odoo/OpenUpgrade/odoo/fields.py", line 2333, in get
return super().get(records, owner)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1015, in get
raise MissingError("\n".join([
odoo.exceptions.MissingError: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,504 2537 CRITICAL bdxxx odoo.service.server: Failed to initialize database bdxxx.
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get
value = self._data[field][record._ids[0]]
KeyError: 1021
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/fields.py", line 1004, in get
value = env.cache.get(record, self)
File "/odoo/OpenUpgrade/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('product.product(1021,).product_tmpl_id', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/service/server.py", line 1190, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/odoo/OpenUpgrade/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 477, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 360, in load_marked_modules
loaded, processed = load_module_graph(
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 256, in load_module_graph
migrations.migrate_module(package, 'post')
File "/odoo/OpenUpgrade/odoo/modules/migration.py", line 185, in migrate_module
migrate(self.cr, installed_version)
File "/usr/local/lib/python3.8/dist-packages/openupgradelib-3.0.0-py3.8.egg/openupgradelib/openupgrade.py", line 1870, in wrapped_function
func(
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 71, in migrate
convert_image_attachments(env)
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 61, in convert_image_attachments
Model.browse(attachment.res_id).image_1920 = attachment.datas
File "/odoo/OpenUpgrade/odoo/fields.py", line 1089, in set
records.write({self.name: write_value})
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 330, in write
res = super(ProductProduct, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_thread.py", line 323, in write
result = super(MailThread, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_activity.py", line 726, in write
return super(MailActivityMixin, self).write(vals)
File "/odoo/OpenUpgrade/odoo/models.py", line 3635, in write
fields[0].determine_inverse(real_recs)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1122, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 160, in _set_image_1920
record.image_1920 and not record.product_tmpl_id.image_1920 or
File "/odoo/OpenUpgrade/odoo/fields.py", line 2333, in get
return super().get(records, owner)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1015, in get
raise MissingError("\n".join([
odoo.exceptions.MissingError: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
@pleirb Maybe the product template of the variant has the same attribute value in different attribute lines.
You are right, I did not realize to check directly in product.prodcut (varying), the product does not really exist! How can it be possible? I am trying to create the record directly in the database but obviously I have problems with the foreign keys. Can it be normal to find gaps in the numbering of the product.product table? If there are cases like this, it would be convenient to control this exception, right?
I tried with the modification made by @sebastienbeau in the post-migration.py (12/22/20) but the error persists. I think the problem is another, really the id of the product variant does not exist in the database, the error is correct. Is there any way to create a record with this record id so that I don't get this error?
As you can see, the id 1021 does not exist and if so, perhaps the product_tmpl_id 955 would correspond to it. And in the product.template table I have this:
Id
.....
953
954
956
957
....
As you can see, the id 955 is not found either. It is very strange, I do not know how this could have happened in postgres, I understand that the IDs must be correlative and otherwise an exception would be executed and the error no? Is there a way to make up these records?
The integrity of the database is violated so you have to remove all records that link to not exist product and product template.
And I think you can close this issue as it not a problem in the migration script. (Your DB may have been migrated before and you lost data)
The integrity of the database is violated so you have to remove all records that link to not exist product and product template.
And I think you can close this issue as it not a problem in the migration script. (Your DB may have been migrated before and you lost data)
Yes, that's right, the database was migrated from 10 to 11 and from 11 to 12
In the end I was able to skip this error, I managed to create a record in product_template and another in product_product by directly manipulating the database
changed the title [-]Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/-][+][ Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/+]on Feb 3, 2021
changed the title [-][ Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/-][+][Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/+]on Feb 3, 2021
Activity
legalsylvain commentedon Jan 21, 2021
Hi.
thanks.
pleirb commentedon Jan 21, 2021
@legalsylvain
Thank you very much for the answer, below you have the complete output and metadata of the related product in V12:
ID: 1021
XML ID: /
No update: false
Creation User: Beatriz Rocha
Creation date: 09/19/2019 12:10:34
Last Modified by: System
Last Date Modified: 09/21/2020 4:16:19 PM
2021-01-21 19:22:10,578 2537 DEBUG bdxxx OpenUpgrade: 285 rows affected after 0:00:00.061979 running
UPDATE product_template_attribute_value ptav
SET attribute_line_id = ptal.id
FROM product_template_attribute_line ptal
JOIN product_template pt ON ptal.product_tmpl_id = pt.id
JOIN product_attribute_value_product_template_attribute_line_rel
avtalr ON avtalr.product_template_attribute_line_id = ptal.id
WHERE ptal.active = TRUE AND ptav.product_tmpl_id = pt.id AND
ptav.product_attribute_value_id = avtalr.product_attribute_value_id
2021-01-21 19:22:10,656 2537 DEBUG bdxxx OpenUpgrade: 285 rows affected after 0:00:00.077993 running
UPDATE product_template_attribute_value ptav
SET attribute_id = ptal.attribute_id
FROM product_template_attribute_line ptal
WHERE ptav.attribute_line_id = ptal.id
2021-01-21 19:22:10,669 2537 DEBUG bdxxx OpenUpgrade: 13 rows affected after 0:00:00.012696 running
INSERT INTO product_variant_combination
(product_product_id, product_template_attribute_value_id)
SELECT pavppr.product_product_id, ptav.id
FROM product_attribute_value_product_product_rel pavppr
JOIN product_product pp
ON pp.id = pavppr.product_product_id
JOIN product_template_attribute_value ptav
ON ptav.product_attribute_value_id = pavppr.product_attribute_value_id
AND pp.product_tmpl_id = ptav.product_tmpl_id
2021-01-21 19:22:10,669 2537 INFO bdxxx OpenUpgrade: product: loading migrations/13.0.1.2/noupdate_changes.xml
2021-01-21 19:22:12,478 2537 ERROR bdxxx OpenUpgrade: product: error in migration script product/migrations/13.0.1.2/post-migration.py: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,478 2537 ERROR bdxxx OpenUpgrade: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get
value = self._data[field][record._ids[0]]
KeyError: 1021
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/fields.py", line 1004, in get
value = env.cache.get(record, self)
File "/odoo/OpenUpgrade/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('product.product(1021,).product_tmpl_id', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/openupgradelib-3.0.0-py3.8.egg/openupgradelib/openupgrade.py", line 1870, in wrapped_function
func(
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 71, in migrate
convert_image_attachments(env)
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 61, in convert_image_attachments
Model.browse(attachment.res_id).image_1920 = attachment.datas
File "/odoo/OpenUpgrade/odoo/fields.py", line 1089, in set
records.write({self.name: write_value})
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 330, in write
res = super(ProductProduct, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_thread.py", line 323, in write
result = super(MailThread, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_activity.py", line 726, in write
return super(MailActivityMixin, self).write(vals)
File "/odoo/OpenUpgrade/odoo/models.py", line 3635, in write
fields[0].determine_inverse(real_recs)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1122, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 160, in _set_image_1920
record.image_1920 and not record.product_tmpl_id.image_1920 or
File "/odoo/OpenUpgrade/odoo/fields.py", line 2333, in get
return super().get(records, owner)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1015, in get
raise MissingError("\n".join([
odoo.exceptions.MissingError: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,487 2537 ERROR bdxxx odoo.modules.loading: Error executing post migration script for module product
`-> stock
: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,501 2537 WARNING bdxxx odoo.modules.loading: Transient module states were reset
2021-01-21 19:22:12,504 2537 ERROR bdxxx odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get
value = self._data[field][record._ids[0]]
KeyError: 1021
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/fields.py", line 1004, in get
value = env.cache.get(record, self)
File "/odoo/OpenUpgrade/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('product.product(1021,).product_tmpl_id', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 477, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 360, in load_marked_modules
loaded, processed = load_module_graph(
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 256, in load_module_graph
migrations.migrate_module(package, 'post')
File "/odoo/OpenUpgrade/odoo/modules/migration.py", line 185, in migrate_module
migrate(self.cr, installed_version)
File "/usr/local/lib/python3.8/dist-packages/openupgradelib-3.0.0-py3.8.egg/openupgradelib/openupgrade.py", line 1870, in wrapped_function
func(
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 71, in migrate
convert_image_attachments(env)
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 61, in convert_image_attachments
Model.browse(attachment.res_id).image_1920 = attachment.datas
File "/odoo/OpenUpgrade/odoo/fields.py", line 1089, in set
records.write({self.name: write_value})
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 330, in write
res = super(ProductProduct, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_thread.py", line 323, in write
result = super(MailThread, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_activity.py", line 726, in write
return super(MailActivityMixin, self).write(vals)
File "/odoo/OpenUpgrade/odoo/models.py", line 3635, in write
fields[0].determine_inverse(real_recs)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1122, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 160, in _set_image_1920
record.image_1920 and not record.product_tmpl_id.image_1920 or
File "/odoo/OpenUpgrade/odoo/fields.py", line 2333, in get
return super().get(records, owner)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1015, in get
raise MissingError("\n".join([
odoo.exceptions.MissingError: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
2021-01-21 19:22:12,504 2537 CRITICAL bdxxx odoo.service.server: Failed to initialize database bdxxx.
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/api.py", line 745, in get
value = self._data[field][record._ids[0]]
KeyError: 1021
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/fields.py", line 1004, in get
value = env.cache.get(record, self)
File "/odoo/OpenUpgrade/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('product.product(1021,).product_tmpl_id', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/OpenUpgrade/odoo/service/server.py", line 1190, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/odoo/OpenUpgrade/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 477, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 360, in load_marked_modules
loaded, processed = load_module_graph(
File "/odoo/OpenUpgrade/odoo/modules/loading.py", line 256, in load_module_graph
migrations.migrate_module(package, 'post')
File "/odoo/OpenUpgrade/odoo/modules/migration.py", line 185, in migrate_module
migrate(self.cr, installed_version)
File "/usr/local/lib/python3.8/dist-packages/openupgradelib-3.0.0-py3.8.egg/openupgradelib/openupgrade.py", line 1870, in wrapped_function
func(
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 71, in migrate
convert_image_attachments(env)
File "/odoo/OpenUpgrade/addons/product/migrations/13.0.1.2/post-migration.py", line 61, in convert_image_attachments
Model.browse(attachment.res_id).image_1920 = attachment.datas
File "/odoo/OpenUpgrade/odoo/fields.py", line 1089, in set
records.write({self.name: write_value})
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 330, in write
res = super(ProductProduct, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_thread.py", line 323, in write
result = super(MailThread, self).write(values)
File "/odoo/OpenUpgrade/addons/mail/models/mail_activity.py", line 726, in write
return super(MailActivityMixin, self).write(vals)
File "/odoo/OpenUpgrade/odoo/models.py", line 3635, in write
fields[0].determine_inverse(real_recs)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1122, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/OpenUpgrade/addons/product/models/product.py", line 160, in _set_image_1920
record.image_1920 and not record.product_tmpl_id.image_1920 or
File "/odoo/OpenUpgrade/odoo/fields.py", line 2333, in get
return super().get(records, owner)
File "/odoo/OpenUpgrade/odoo/fields.py", line 1015, in get
raise MissingError("\n".join([
odoo.exceptions.MissingError: ('Record does not exist or has been deleted.\n(Record: product.product(1021,), User: 1)', None)
pleirb commentedon Jan 21, 2021
What is strange is that the product has been modified by the user of the system compared to the rest, it might be the only case like this
kos94ok-3D commentedon Feb 1, 2021
@pleirb Maybe the product template of the variant has the same attribute value in different attribute lines.
pleirb commentedon Feb 1, 2021
You are right, I did not realize to check directly in product.prodcut (varying), the product does not really exist! How can it be possible? I am trying to create the record directly in the database but obviously I have problems with the foreign keys. Can it be normal to find gaps in the numbering of the product.product table? If there are cases like this, it would be convenient to control this exception, right?
kos94ok-3D commentedon Feb 2, 2021
You can try to use #2488
pleirb commentedon Feb 2, 2021
I tried with the modification made by @sebastienbeau in the post-migration.py (12/22/20) but the error persists. I think the problem is another, really the id of the product variant does not exist in the database, the error is correct. Is there any way to create a record with this record id so that I don't get this error?
kos94ok-3D commentedon Feb 2, 2021
Archive product template before migration and active after.
kos94ok-3D commentedon Feb 2, 2021
I think PR: #2513 will help you after merging
pleirb commentedon Feb 2, 2021
Yes, I thought about this but I don't know what to file. My product.product table looks like this:
Id | product_tmpl_id
.........|.......
1019 | 953
1020 | 954
1022 | 956
1023 | 957
.........|.......
As you can see, the id 1021 does not exist and if so, perhaps the product_tmpl_id 955 would correspond to it. And in the product.template table I have this:
Id
.....
953
954
956
957
....
As you can see, the id 955 is not found either. It is very strange, I do not know how this could have happened in postgres, I understand that the IDs must be correlative and otherwise an exception would be executed and the error no? Is there a way to make up these records?
pleirb commentedon Feb 2, 2021
I found the product id (1021) in the following two tables: product_taxes_rel and product_suplier_taxes_rel. Will it have something to do with it?
kos94ok-3D commentedon Feb 3, 2021
The integrity of the database is violated so you have to remove all records that link to not exist product and product template.
And I think you can close this issue as it not a problem in the migration script. (Your DB may have been migrated before and you lost data)
pleirb commentedon Feb 3, 2021
Yes, that's right, the database was migrated from 10 to 11 and from 11 to 12
pleirb commentedon Feb 3, 2021
In the end I was able to skip this error, I managed to create a record in product_template and another in product_product by directly manipulating the database
[-]Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/-][+][ Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/+][-][ Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/-][+][Solved] Product related error when migrating from 12 to 13. Record does not exist or has been deleted[/+]