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
128b94e910
commit
b202302712
@ -512,6 +512,21 @@ class BuildErrorContent(models.Model):
|
||||
for errors_content_to_merge in to_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):
|
||||
|
||||
|
@ -241,6 +241,7 @@
|
||||
create="false"
|
||||
>
|
||||
<header>
|
||||
<button name="action_find_duplicates" type="object" string="Find duplicates" display="always"/>
|
||||
</header>
|
||||
<field name="error_display_id" optional="show"/>
|
||||
<field name="module_name" optional="show" readonly="1"/>
|
||||
@ -393,7 +394,15 @@
|
||||
<field name="view_mode">tree,form</field>
|
||||
</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>
|
||||
</odoo>
|
||||
|
Loading…
Reference in New Issue
Block a user