Hello, I post this error here as I think its the correct location.
I deleted through admin debug mode UI the carrier "Free delivery charges" as it wasnt needed, it was created automatically after migration and it wasnt neccesary. After deleting no error warning appeared. I kept working on other things and I wanted --update all the database and the error appeared on terminal and doesnt let the DB finish loading as far as this is a critical error. I think the error is due to deleting this carrier. I checked through sql and indeed the product_id 1186 doesnt appear in the tables delivery_carrier, either the id appears in product_product table
Temporary I can ignore the error commenting the record in addons/delivery/data/delivery_data.xml
How can I recreate the record? I tried modifying the noupdate=1 to noupdate=0 but it doesnt fix the error
2020-04-04 13:41:26,965 8513 ERROR odoo12 odoo.sql_db: bad query: INSERT INTO "delivery_carrier" ("id", "create_uid", "create_date", "write_uid", "write_date", "active", "amount", "debug_logging", "delivery_type", "fixed_price", "free_over", "integration_level", "name", "prod_environment", "product_id", "sequence") VALUES (nextval('delivery_carrier_id_seq'), 1, (now() at time zone 'UTC'), 1, (now() at time zone 'UTC'), true, 1000.0, false, 'fixed', 0.0, true, 'rate_and_ship', 'Free delivery charges', false, 1186, 1) RETURNING id
ERROR: inserción o actualización en la tabla «delivery_carrier» viola la llave foránea «delivery_carrier_product_id_fkey»
DETAIL: La llave (product_id)=(1186) no está presente en la tabla «product_product».
2020-04-04 13:41:26,972 8513 WARNING odoo12 odoo.modules.loading: Transient module states were reset
2020-04-04 13:41:26,976 8513 ERROR odoo12 odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 758, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 663, in _tag_record
record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3888, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3802, in _load_records_create
return self.create(values)
File "<decorator-gen-3>", line 2, in create
File "/opt/odoo/OCB12/OCB/odoo/api.py", line 462, in _model_create_multi
return create(self, arg)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3583, in create
records = self._create(data_list)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3683, in _create
cr.execute(query, params)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 148, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 225, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: inserción o actualización en la tabla «delivery_carrier» viola la llave foránea «delivery_carrier_product_id_fkey»
DETAIL: La llave (product_id)=(1186) no está presente en la tabla «product_product».
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/odoo/OCB12/OCB/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report)
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 802, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 865, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 755, in parse
self.parse(rec, mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 764, in parse
exc_info[2]
File "/opt/odoo/OCB12/OCB/odoo/tools/pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 758, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 663, in _tag_record
record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3888, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3802, in _load_records_create
return self.create(values)
File "<decorator-gen-3>", line 2, in create
File "/opt/odoo/OCB12/OCB/odoo/api.py", line 462, in _model_create_multi
return create(self, arg)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3583, in create
records = self._create(data_list)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3683, in _create
cr.execute(query, params)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 148, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 225, in execute
res = self._obj.execute(query, params)
odoo.tools.convert.ParseError: "inserción o actualización en la tabla «delivery_carrier» viola la llave foránea «delivery_carrier_product_id_fkey»
DETAIL: La llave (product_id)=(1186) no está presente en la tabla «product_product».
" while parsing /opt/odoo/OCB12/OCB/addons/delivery/data/delivery_data.xml:17, near
<record id="free_delivery_carrier" model="delivery.carrier">
<field name="name">Free delivery charges</field>
<field name="fixed_price">0.0</field>
<field name="free_over" eval="True"/>
<field name="amount">1000</field>
<field name="sequence">1</field>
<field name="delivery_type">fixed</field>
<field name="product_id" ref="delivery.product_product_delivery"/>
</record>
2020-04-04 13:41:26,980 8513 CRITICAL odoo12 odoo.service.server: Failed to initialize database `odoo12`.
Traceback (most recent call last):
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 758, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 663, in _tag_record
record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3888, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3802, in _load_records_create
return self.create(values)
File "<decorator-gen-3>", line 2, in create
File "/opt/odoo/OCB12/OCB/odoo/api.py", line 462, in _model_create_multi
return create(self, arg)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3583, in create
records = self._create(data_list)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3683, in _create
cr.execute(query, params)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 148, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 225, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: inserción o actualización en la tabla «delivery_carrier» viola la llave foránea «delivery_carrier_product_id_fkey»
DETAIL: La llave (product_id)=(1186) no está presente en la tabla «product_product».
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/odoo/OCB12/OCB/odoo/service/server.py", line 1151, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/opt/odoo/OCB12/OCB/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report)
File "/opt/odoo/OCB12/OCB/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 802, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 865, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 755, in parse
self.parse(rec, mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 764, in parse
exc_info[2]
File "/opt/odoo/OCB12/OCB/odoo/tools/pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 758, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/odoo/OCB12/OCB/odoo/tools/convert.py", line 663, in _tag_record
record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3888, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3802, in _load_records_create
return self.create(values)
File "<decorator-gen-3>", line 2, in create
File "/opt/odoo/OCB12/OCB/odoo/api.py", line 462, in _model_create_multi
return create(self, arg)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3583, in create
records = self._create(data_list)
File "/opt/odoo/OCB12/OCB/odoo/models.py", line 3683, in _create
cr.execute(query, params)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 148, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/OCB12/OCB/odoo/sql_db.py", line 225, in execute
res = self._obj.execute(query, params)
odoo.tools.convert.ParseError: "inserción o actualización en la tabla «delivery_carrier» viola la llave foránea «delivery_carrier_product_id_fkey»
DETAIL: La llave (product_id)=(1186) no está presente en la tabla «product_product».
" while parsing /opt/odoo/OCB12/OCB/addons/delivery/data/delivery_data.xml:17, near
<record id="free_delivery_carrier" model="delivery.carrier">
<field name="name">Free delivery charges</field>
<field name="fixed_price">0.0</field>
<field` name="free_over" eval="True"/>
<field name="amount">1000</field>
<field name="sequence">1</field>
<field name="delivery_type">fixed</field>
<field name="product_id" ref="delivery.product_product_delivery"/>
</record>