mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
not working wip, todo fix context
This commit is contained in:
parent
6fe80265ba
commit
b8938a71ca
@ -9,6 +9,7 @@ from dateutil.relativedelta import relativedelta
|
||||
from markupsafe import Markup
|
||||
from werkzeug.urls import url_join
|
||||
from odoo import models, fields, api
|
||||
from odoo.osv import expression
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
from odoo.tools import SQL
|
||||
|
||||
@ -245,10 +246,7 @@ class BuildError(models.Model):
|
||||
def _onchange_test_tags(self):
|
||||
if self.test_tags and self.version_ids:
|
||||
self.tags_min_version_id = min(self.version_ids, key=lambda rec: rec.number)
|
||||
self.tags_max_version_id = max(self.version_ids, key=lambda rec: rec.number)
|
||||
|
||||
@api.onchange('customer')
|
||||
def _onchange_customer(self):
|
||||
self.tags_max_version_id
|
||||
if not self.responsible:
|
||||
self.responsible = self.customer
|
||||
|
||||
@ -322,6 +320,8 @@ class BuildError(models.Model):
|
||||
self.ensure_one()
|
||||
return Markup('<a href="%s">%s</a>') % (self._get_form_url(), self.id)
|
||||
|
||||
|
||||
|
||||
def action_view_errors(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
@ -332,6 +332,32 @@ class BuildError(models.Model):
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
def action_search_similar(self):
|
||||
domain = []
|
||||
available_fields = self.env['runbot.build.error.content']._fields.keys()
|
||||
for key, value in self.unique_qualifiers.items():
|
||||
field = f'x_{key}'
|
||||
if field not in available_fields:
|
||||
continue # todo add leaf for json?
|
||||
leaf = [(field, '=', value)]
|
||||
if key not in self.common_qualifiers:
|
||||
domain += expression.OR([leaf, [(field, '=', False)]])
|
||||
else:
|
||||
domain += leaf
|
||||
|
||||
search_context = {
|
||||
'search_default_context_filter': True,
|
||||
'filter_domain': domain,
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(False, 'list'), (False, 'form')],
|
||||
'res_model': 'runbot.build.error.content',
|
||||
'domain': domain,
|
||||
'context': {'active_test': False, **search_context},
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
def action_view_similary_qualified(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
|
@ -8,6 +8,7 @@
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" invisible="not test_tags"/>
|
||||
<button name="action_view_errors" string="See all linked errors" type="object" class="oe_highlight"/>
|
||||
<button name="action_search_similar" string="Search similar" type="object" class="oe_highlight"/>
|
||||
<group string="Base info">
|
||||
<field name="name"/>
|
||||
<field name="error_content_ids" readonly="1">
|
||||
@ -459,6 +460,7 @@
|
||||
<filter string="Test Tags" name="test_tagged_errors" domain="[('test_tags', '!=', False)]"/>
|
||||
<separator/>
|
||||
<filter string="Not seen in one month" name="not_seen_one_month" domain="[('last_seen_date','<', (context_today() - datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter string="Qualifiers" name="context_filter" domain="context.get('filter_domain')" invisible="1"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
Loading…
Reference in New Issue
Block a user