summaryrefslogtreecommitdiff
path: root/addons/note/models/note.py
diff options
context:
space:
mode:
authorVandan Shah <vas@odoo.com>2017-12-07 11:17:11 +0530
committerChristophe Matthieu <chm@odoo.com>2018-02-28 11:27:02 +0100
commit74a813542fcbcc069024db8f52aedc1199a879e6 (patch)
tree793dd85ecbe3bccf015cdf3a0ddbf15ab2dbcd36 /addons/note/models/note.py
parent476d125b6339812a1b534eb93ab057041a40b26c (diff)
[IMP] note: Use first stage as default stage_id if is stage_id empty
UI improvement: If there is no stage then there will be no button(no status bar) but there will be stages but task or note etc.. will not be in any stage then there will be 'undefined' so by click on that ('undefined') user can move to any stages. To avoid this behavior we add a default stage in note.
Diffstat (limited to 'addons/note/models/note.py')
-rw-r--r--addons/note/models/note.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/note/models/note.py b/addons/note/models/note.py
index 2861bb9d0ff..d8a0a9b94f6 100644
--- a/addons/note/models/note.py
+++ b/addons/note/models/note.py
@@ -45,7 +45,7 @@ class Note(models.Model):
memo = fields.Html('Note Content')
sequence = fields.Integer('Sequence')
stage_id = fields.Many2one('note.stage', compute='_compute_stage_id',
- inverse='_inverse_stage_id', string='Stage')
+ inverse='_inverse_stage_id', string='Stage', default=_get_default_stage_id)
stage_ids = fields.Many2many('note.stage', 'note_stage_rel', 'note_id', 'stage_id',
string='Stages of Users', default=_get_default_stage_id)
open = fields.Boolean(string='Active', default=True)
@@ -62,9 +62,13 @@ class Note(models.Model):
@api.multi
def _compute_stage_id(self):
+ first_user_stage = self.env['note.stage'].search([('user_id', '=', self.env.uid)], limit=1)
for note in self:
for stage in note.stage_ids.filtered(lambda stage: stage.user_id == self.env.user):
note.stage_id = stage
+ # note without user's stage
+ if not note.stage_id:
+ note.stage_id = first_user_stage
@api.multi
def _inverse_stage_id(self):