[NEW] Add State field and buttons to manipulate its value
This commit is contained in:
@@ -15,3 +15,19 @@ class MajorityJudgementVote(models.Model):
|
||||
grade_ids = fields.One2many("grade", "vote_id", string=_("Grades"))
|
||||
candidate_ids = fields.One2many("candidate", "vote_id", string=_("Candidate"))
|
||||
voter_ids = fields.One2many("voter", "vote_id", string=_("Voters"))
|
||||
|
||||
state = fields.Selection(
|
||||
[("draft", "Draft"), ("opened", "Opened"), ("closed", "Closed")],
|
||||
string=_("Status"),
|
||||
index=True,
|
||||
readonly=True,
|
||||
default="draft",
|
||||
track_visibility="onchange",
|
||||
copy=False,
|
||||
)
|
||||
|
||||
def action_open_vote(self):
|
||||
self.state = "opened"
|
||||
|
||||
def action_close_vote(self):
|
||||
self.state = "closed"
|
||||
|
Reference in New Issue
Block a user