[IMP] runbot_merge: allow sorting & deactivating branches

Closes #144, closes #145
This commit is contained in:
Christophe Simonis 2019-06-28 11:31:06 +02:00 committed by xmo-odoo
parent 84ad4cefe0
commit 5e611f54cb
3 changed files with 9 additions and 2 deletions

View File

@ -32,6 +32,7 @@ class Project(models.Model):
)
branch_ids = fields.One2many(
'runbot_merge.branch', 'project_id',
context={'active_test': False},
help="Branches of all project's repos which are managed by the merge bot. Also "\
"target branches of PR this project handles."
)
@ -232,6 +233,7 @@ class Repository(models.Model):
class Branch(models.Model):
_name = 'runbot_merge.branch'
_order = 'sequence, name'
name = fields.Char(required=True)
project_id = fields.Many2one('runbot_merge.project', required=True)
@ -248,6 +250,9 @@ class Branch(models.Model):
('state', '!=', 'merged'),
])
active = fields.Boolean(default=True)
sequence = fields.Integer()
def _auto_init(self):
res = super(Branch, self)._auto_init()
tools.create_unique_index(

View File

@ -42,8 +42,10 @@
</field>
<separator string="Branches"/>
<field name="branch_ids">
<tree editable="bottom">
<tree editable="bottom" decoration-muted="not active">
<field name="sequence" widget="handle" />
<field name="name"/>
<field name="active"/>
</tree>
</field>
</sheet>

View File

@ -44,7 +44,7 @@
<li class="bg-gray-lighter">cancelled</li>
</ul>
</div>
<section t-foreach="project.branch_ids" t-as="branch" class="col-md-12">
<section t-foreach="project.branch_ids" t-as="branch" t-if="branch.active" class="col-md-12">
<h2><t t-esc="branch.name"/></h2>
<t t-call="runbot_merge.stagings"/>
<t t-set="ready_unstaged" t-value="