shopinvader / odoo-shopinvader

Odoo Modules. Sorry Magento, Shopinvader is coming
GNU Affero General Public License v3.0
121 stars 104 forks source link

Impossible to run `shopinvader` tests twice #839

Closed simahawk closed 11 months ago

simahawk commented 3 years ago
odoo -d test_invader_data -i shopinvader --stop-after-init
odoo -d test_invader_data -u shopinvader --stop-after-init --test-enable

All good, tests pass, BUT see what happens at the end of the tests:

2021-01-15 08:48:35,888 11813 INFO test_invader_data odoo.modules.module: Ran 1 test in 1.200s 
2021-01-15 08:48:35,917 11813 INFO test_invader_data odoo.modules.loading: 52 modules loaded in 74.15s, 50320 queries 
2021-01-15 08:48:36,250 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 26@product.template.attribute.value (shopinvader.product_template_thelma_attribute_color_black) 
2021-01-15 08:48:36,379 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 27@product.template.attribute.value (shopinvader.product_template_thelma_attribute_color_grey) 
2021-01-15 08:48:36,507 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 28@product.template.attribute.value (shopinvader.product_template_thelma_attribute_color_red) 
2021-01-15 08:48:36,561 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 25@product.template.attribute.value (shopinvader.product_template_round_table_mid_century_attribute_color_blue) 
2021-01-15 08:48:36,607 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 24@product.template.attribute.value (shopinvader.product_template_tv_cabinet_mid_century_attribute_color_brown) 
2021-01-15 08:48:36,810 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 22@product.template.attribute.value (shopinvader.product_template_tv_cabinet_shaker_wood_attribute_color_brown) 
2021-01-15 08:48:36,854 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 21@product.template.attribute.value (shopinvader.product_template_tv_cabinet_cmcharper_attribute_color_brown) 
2021-01-15 08:48:36,904 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 20@product.template.attribute.value (shopinvader.product_template_tv_stand_wood_and_glass_attribute_color_blue) 
2021-01-15 08:48:36,964 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 19@product.template.attribute.value (shopinvader.product_template_coffee_table_caftman_attribute_color_brown) 
2021-01-15 08:48:37,026 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 18@product.template.attribute.value (shopinvader.product_template_tv_cabinet_concept_design_attribute_color_white) 
2021-01-15 08:48:37,071 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 15@product.template.attribute.value (shopinvader.product_template_chair_mid_century_attribute_color_red) 
2021-01-15 08:48:37,199 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 17@product.template.attribute.value (shopinvader.product_template_chair_mid_century_attribute_color_black) 
2021-01-15 08:48:37,319 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 14@product.template.attribute.value (shopinvader.product_template_chair_mid_century_attribute_color_white) 
2021-01-15 08:48:37,442 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 16@product.template.attribute.value (shopinvader.product_template_chair_mid_century_attribute_color_blue) 
2021-01-15 08:48:37,481 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 13@product.template.attribute.value (shopinvader.product_template_armchair_mid_century_attribute_color_red) 
2021-01-15 08:48:37,601 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 12@product.template.attribute.value (shopinvader.product_template_armchair_mid_century_attribute_color_yellow) 
2021-01-15 08:48:37,717 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 11@product.template.attribute.value (shopinvader.product_template_armchair_mid_century_attribute_color_grey) 
2021-01-15 08:48:37,833 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 10@product.template.attribute.value (shopinvader.product_template_armchair_mid_century_attribute_color_blue) 
2021-01-15 08:48:37,883 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 8@product.template.attribute.value (shopinvader.product_template_chair_vortex_attribute_color_blue) 
2021-01-15 08:48:38,003 11813 INFO test_invader_data odoo.addons.base.models.ir_model: Deleting 9@product.template.attribute.value (shopinvader.product_template_chair_vortex_attribute_color_white) 

All attributes are deleted. Then, if you run tests again, you get:

2021-01-15 08:50:54,769 12377 INFO test_invader_data odoo.modules.loading: loading shopinvader/demo/product_product_demo.xml 
2021-01-15 08:50:55,082 12377 ERROR test_invader_data odoo.sql_db: bad query: UPDATE "product_product" SET "can_image_variant_1024_be_zoomed"=false,"combination_indices"='',"is_shopinvader_binded"=false,"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (96, 97, 88, 89, 90, 91, 92, 93, 94, 95)
ERROR: duplicate key value violates unique constraint "product_product_combination_unique"
DETAIL:  Key (product_tmpl_id, combination_indices)=(29, ) already exists.

2021-01-15 08:50:55,083 12377 WARNING test_invader_data odoo.modules.loading: Transient module states were reset 
2021-01-15 08:50:55,084 12377 ERROR test_invader_data odoo.modules.registry: Failed to load registry 
Traceback (most recent call last):
  File "/path/to/odoo/src/odoo/modules/registry.py", line 86, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/path/to/odoo/src/odoo/modules/loading.py", line 419, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/path/to/odoo/src/odoo/modules/loading.py", line 315, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/path/to/odoo/src/odoo/modules/loading.py", line 234, in load_module_graph
    module.with_context(overwrite=overwrite)._update_translations()
  File "/path/to/odoo/src/odoo/addons/base/models/ir_module.py", line 894, in _update_translations
    self.env['ir.translation']._load_module_terms(mod_names, filter_lang)
  File "/path/to/odoo/src/odoo/addons/base/models/ir_translation.py", line 801, in _load_module_terms
    res_lang.load_lang(lang)
  File "/path/to/odoo/src/odoo/addons/base/models/res_lang.py", line 97, in load_lang
    language.write({'active': True})
  File "/path/to/odoo/src/odoo/addons/base/models/res_lang.py", line 253, in write
    self.flush()
  File "/path/to/odoo/src/odoo/models.py", line 5502, in flush
    process(self.env[model_name], id_vals)
  File "/path/to/odoo/src/odoo/models.py", line 5493, in process
    recs._write(vals)
  File "/path/to/odoo/src/odoo/models.py", line 3696, in _write
    cr.execute(query, params + [sub_ids])
  File "/path/to/odoo/src/odoo/sql_db.py", line 173, in wrapper
    return f(self, *args, **kwargs)
  File "/path/to/odoo/src/odoo/sql_db.py", line 250, in execute
    res = self._obj.execute(query, params)
psycopg2.IntegrityError: duplicate key value violates unique constraint "product_product_combination_unique"
DETAIL:  Key (product_tmpl_id, combination_indices)=(29, ) already exists.

Then you are stuck and cannot run them anymore. Am I the only one experiencing this?

@lmignon @sebastienbeau ?

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.