[IMP] runbot_merge: disable active test on batch fields

For post-mortem investigations and manipulations, they're inconvenient
as the batches are deactivated on success and failure.
This commit is contained in:
Xavier Morel 2021-08-03 14:14:44 +02:00 committed by xmo-odoo
parent 52b6776204
commit 30cfc4fe59
2 changed files with 3 additions and 2 deletions

View File

@ -194,7 +194,7 @@ def test_failed_staging(env, config, make_repo):
assert len(pr3_head) == 1
assert not pr3_id.batch_id, "check that the PR indeed has no batch anymore"
assert not pr3_id.batch_ids
assert not pr3_id.batch_ids.filtered(lambda b: b.active)
assert len(env['runbot_merge.batch'].search([
('prs', 'in', pr3_id.id),

View File

@ -705,7 +705,7 @@ class PullRequests(models.Model):
previous_failure = fields.Char(default='{}')
batch_id = fields.Many2one('runbot_merge.batch', string="Active Batch", compute='_compute_active_batch', store=True)
batch_ids = fields.Many2many('runbot_merge.batch', string="Batches")
batch_ids = fields.Many2many('runbot_merge.batch', string="Batches", context={'active_test': False})
staging_id = fields.Many2one(related='batch_id.staging_id', store=True)
commits_map = fields.Char(help="JSON-encoded mapping of PR commits to actually integrated commits. The integration head (either a merge commit or the PR's topmost) is mapped from the 'empty' pr commit (the key is an empty string, because you can't put a null key in json maps).", default='{}')
@ -1642,6 +1642,7 @@ class Stagings(models.Model):
batch_ids = fields.One2many(
'runbot_merge.batch', 'staging_id',
context={'active_test': False},
)
state = fields.Selection([
('success', 'Success'),