Skip to content

Instantly share code, notes, and snippets.

@sehrishnaz
Created May 12, 2022 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sehrishnaz/7b0a5743809c0c184c29e9ae267871b9 to your computer and use it in GitHub Desktop.
Save sehrishnaz/7b0a5743809c0c184c29e9ae267871b9 to your computer and use it in GitHub Desktop.
How to use and implement ProgressBar widget in Odoo
class gym_body_parts_config(models.Model):
_name = 'gym.body.parts.config'
sequence = fields.Integer(default=10,help="Gives the sequence order when displaying a list of records.")
name = fields.Char(string="Name", required=True)
progress_bar = fields.Integer(compute='_compute_progress_bar')
@api.depends('name','sequence')
def _compute_progress_bar(self):
for u in self:
if u.name and u.sequence:
progress = 100
elif u.name:
progress = 50
else:
progress = 0
u.progress_bar = progress
@sehrishnaz
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment