mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: find duplicate error contents
This commit is contained in:
parent
276b43b729
commit
60f7f195bf
@ -516,6 +516,21 @@ class BuildErrorContent(models.Model):
|
|||||||
for errors_content_to_merge in to_merge:
|
for errors_content_to_merge in to_merge:
|
||||||
errors_content_to_merge._merge()
|
errors_content_to_merge._merge()
|
||||||
|
|
||||||
|
def action_find_duplicates(self):
|
||||||
|
rg = [r['id_arr'] for r in self.env['runbot.build.error.content'].read_group([], ['id_count:count(id)', 'id_arr:array_agg(id)', 'fingerprint'], ['fingerprint']) if r['id_count'] >1]
|
||||||
|
duplicate_ids = []
|
||||||
|
for ids_lists in rg:
|
||||||
|
duplicate_ids += ids_lists
|
||||||
|
|
||||||
|
return {
|
||||||
|
"type": "ir.actions.act_window",
|
||||||
|
"res_model": "runbot.build.error.content",
|
||||||
|
"domain": [('id', 'in', duplicate_ids)],
|
||||||
|
"context": {"create": False, 'group_by': ['fingerprint']},
|
||||||
|
"name": "Duplicate Error contents",
|
||||||
|
'view_mode': 'tree,form'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class BuildErrorTag(models.Model):
|
class BuildErrorTag(models.Model):
|
||||||
|
|
||||||
|
@ -241,6 +241,7 @@
|
|||||||
create="false"
|
create="false"
|
||||||
>
|
>
|
||||||
<header>
|
<header>
|
||||||
|
<button name="action_find_duplicates" type="object" string="Find duplicates" display="always"/>
|
||||||
</header>
|
</header>
|
||||||
<field name="error_display_id" optional="show"/>
|
<field name="error_display_id" optional="show"/>
|
||||||
<field name="module_name" optional="show" readonly="1"/>
|
<field name="module_name" optional="show" readonly="1"/>
|
||||||
@ -393,7 +394,15 @@
|
|||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="action_find_duplicates" model="ir.actions.server">
|
||||||
|
<field name="name">Find Duplicates</field>
|
||||||
|
<field name="model_id" ref="runbot.model_runbot_build_error_content"/>
|
||||||
|
<field name="type">ir.actions.server</field>
|
||||||
|
<field name="state">code</field>
|
||||||
|
<field name="code">
|
||||||
|
action = model._find_duplicates()
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
Loading…
Reference in New Issue
Block a user