Browse Source

Oct 03: [FIX] Bug fixed 'projects_task_checklists'

pull/337/head
Cybrosys Technologies 7 months ago
parent
commit
08d71cf05d
  1. 4
      projects_task_checklists/doc/RELEASE_NOTES.md
  2. 8
      projects_task_checklists/models/checklist.py
  3. 5
      projects_task_checklists/views/checklist_add.xml

4
projects_task_checklists/doc/RELEASE_NOTES.md

@ -5,7 +5,7 @@
#### ADD
- Initial commit for projects_task_checklists
#### 21.12.2023
#### 03.10.2024
#### Version 16.0.1.0.1
#### FIX
- Bug fix on checklist status
- Bug fix on progress field name

8
projects_task_checklists/models/checklist.py

@ -75,7 +75,7 @@ class ChecklistProgress(models.Model):
start_date = fields.Datetime(string='Start Date')
end_date = fields.Datetime(string='End Date')
progress = fields.Float(compute='_compute_progress', string='Progress in %')
checklist_progress = fields.Float(compute='_compute_checklist_progress', string='Progress in %')
checklist_ids = fields.Many2many('task.checklist', compute='_compute_checklist_ids')
checklist_id = fields.Many2one('task.checklist')
checklists = fields.One2many('checklist.item.line', 'projects_id', string='CheckList Items', required=True)
@ -94,14 +94,14 @@ class ChecklistProgress(models.Model):
for rec in self:
self.checklist_ids = self.env['task.checklist'].search([('task_ids', '=', rec.id)])
def _compute_progress(self):
def _compute_checklist_progress(self):
for rec in self:
total_completed = 0
for activity in rec.checklists:
if activity.state in ['cancel', 'done', 'in_progress']:
total_completed += 1
if total_completed:
rec.progress = float(total_completed) / len(rec.checklists) * 100
rec.checklist_progress = float(total_completed) / len(rec.checklists) * 100
else:
rec.progress = 0.0
rec.checklist_progress = 0.0

5
projects_task_checklists/views/checklist_add.xml

@ -47,7 +47,7 @@
<field name="inherit_id" ref="project.view_task_tree2"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='activity_ids']" position="after">
<field name="progress" widget="progressbar"/>
<field name="checklist_progress" widget="progressbar"/>
</xpath>
</field>
</record>
@ -61,9 +61,8 @@
<xpath expr="//field[@name='partner_id']" position="after">
<field name="start_date"/>
<field name="end_date"/>
<field name="progress" widget="progressbar" class="oe_inline"/>
<field name="checklist_progress" widget="progressbar" class="oe_inline"/>
</xpath>
</field>
</record>
</odoo>

Loading…
Cancel
Save