Skip to content

Instantly share code, notes, and snippets.

@sehrishnaz
Created May 12, 2022 08:42
Show Gist options
  • Save sehrishnaz/2172a36372adf00943c157bbb552ace6 to your computer and use it in GitHub Desktop.
Save sehrishnaz/2172a36372adf00943c157bbb552ace6 to your computer and use it in GitHub Desktop.
How to use and implement Percentpie 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_percentpie = fields.Integer(compute='_compute_progress_percentpie')
@api.depends('name','sequence')
def _compute_progress_percentpie(self):
for u in self:
if u.name and u.sequence:
progress = 100
elif u.name:
progress = 50
else:
progress = 0
u.progress_percentpie = progress
@sehrishnaz
Copy link
Author

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