Browse Source

Dec 21 : [UPDT] Bug Fixed 'projects_task_checklists'

pull/299/head
AjmalCybro 1 year ago
parent
commit
3ff7751c9e
  1. 2
      projects_task_checklists/README.rst
  2. 2
      projects_task_checklists/__init__.py
  3. 3
      projects_task_checklists/__manifest__.py
  4. 4
      projects_task_checklists/doc/RELEASE_NOTES.md
  5. 2
      projects_task_checklists/models/__init__.py
  6. 57
      projects_task_checklists/models/checklist.py
  7. 1
      projects_task_checklists/models/stage.py
  8. 1
      projects_task_checklists/security/ir.model.access.csv
  9. 6
      projects_task_checklists/views/checklist_add.xml
  10. 13
      projects_task_checklists/views/checklist_menu.xml

2
projects_task_checklists/README.rst

@ -4,7 +4,7 @@ Projects task checklists
Installation Installation
============ ============
- www.odoo.com/documentation/15.0/setup/install.html - www.odoo.com/documentation/16.0/setup/install.html
- Install our custom addon - Install our custom addon
Configuration Configuration

2
projects_task_checklists/__init__.py

@ -4,7 +4,6 @@
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -18,5 +17,4 @@
# If not, see <https://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from . import models from . import models

3
projects_task_checklists/__manifest__.py

@ -4,7 +4,6 @@
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -20,7 +19,7 @@
############################################################################## ##############################################################################
{ {
'name': 'Project Task Checklist', 'name': 'Project Task Checklist',
'version': '16.0.1.0.0', 'version': '16.0.1.0.1',
'category': 'Project/Project', 'category': 'Project/Project',
'summary': "To Manage the Project's tasks, subtasks checklists", 'summary': "To Manage the Project's tasks, subtasks checklists",
'description': "To Manage the Project's tasks, subtasks checklists", 'description': "To Manage the Project's tasks, subtasks checklists",

4
projects_task_checklists/doc/RELEASE_NOTES.md

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

2
projects_task_checklists/models/__init__.py

@ -4,7 +4,6 @@
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -18,6 +17,5 @@
# If not, see <https://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from . import stage from . import stage
from . import checklist from . import checklist

57
projects_task_checklists/models/checklist.py

@ -4,7 +4,6 @@
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
@ -27,30 +26,36 @@ class TaskChecklist(models.Model):
name = fields.Char(string='Name') name = fields.Char(string='Name')
description = fields.Char(string='Description') description = fields.Char(string='Description')
project_id = fields.Many2one('project.project', string='Project')
task_ids = fields.Many2one('project.task', string='Task') task_ids = fields.Many2one('project.task', string='Task')
project_id = fields.Many2one('project.project', string='Project')
checklist_ids = fields.One2many('checklist.item', 'checklist_id', checklist_ids = fields.One2many('checklist.item', 'checklist_id', string='CheckList Items', required=True)
string='CheckList Items', required=True)
class ChecklistItem(models.Model): class CheckListItem(models.Model):
_name = 'checklist.item' _name = 'checklist.item'
_description = 'Checklist Item' _description = "Checklist Item"
name = fields.Char(required=True) name = fields.Char(required=True)
sequence = fields.Integer(default=1) sequence = fields.Integer(default=1)
description = fields.Char() description = fields.Char()
checklist_id = fields.Many2one('task.checklist')
class ChecklistItemLine(models.Model):
_name = 'checklist.item.line'
_description = 'Checklist Item Line'
check_list_item_id = fields.Many2one('checklist.item', required=True)
description = fields.Char()
projects_id = fields.Many2one('project.task') projects_id = fields.Many2one('project.task')
checklist_id = fields.Many2one('task.checklist') checklist_id = fields.Many2one('task.checklist')
state = fields.Selection( state = fields.Selection(string='Status', required=True, readonly=True, copy=False, tracking=True, selection=[
string='Status', required=True, readonly=True, copy=False, ('todo', 'To Do'),
tracking=True, selection=[ ('in_progress', 'In Progress'),
('todo', 'To Do'), ('done', 'Done'),
('in_progress', 'In Progress'), ('cancel', 'Cancelled'),
('done', 'Done'), ], default='todo', )
('cancel', 'Cancelled'),
], default='todo', )
def approve_and_next(self): def approve_and_next(self):
self.state = 'in_progress' self.state = 'in_progress'
@ -71,17 +76,23 @@ class ChecklistProgress(models.Model):
start_date = fields.Datetime(string='Start Date') start_date = fields.Datetime(string='Start Date')
end_date = fields.Datetime(string='End Date') end_date = fields.Datetime(string='End Date')
progress = fields.Float(compute='_compute_progress', string='Progress in %') progress = fields.Float(compute='_compute_progress', string='Progress in %')
checklist_ids = fields.Many2many('task.checklist', compute='_compute_checklist_ids')
checklist_id = fields.Many2one('task.checklist') checklist_id = fields.Many2one('task.checklist')
checklists = fields.One2many('checklist.item', 'projects_id', checklists = fields.One2many('checklist.item.line', 'projects_id', string='CheckList Items', required=True)
string='CheckList Items', required=True)
@api.onchange('checklist_id') @api.onchange('checklist_id')
def _onchange_project_id(self): def _onchange_project_id(self):
self.checklists = [] checklist = self.env['task.checklist'].search([('name', '=', self.checklist_id.name)])
checklist = self.env['task.checklist'].search( self.checklists = False
[('name', '=', self.checklist_id.name)]) self.checklists = [(0, 0, {
for rec in checklist: 'check_list_item_id': rec.id,
self.checklists += rec.checklist_ids 'state': 'todo',
'checklist_id': self.checklist_id.id,
}) for rec in checklist.checklist_ids]
def _compute_checklist_ids(self):
for rec in self:
self.checklist_ids = self.env['task.checklist'].search([('task_ids', '=', rec.id)])
def _compute_progress(self): def _compute_progress(self):
for rec in self: for rec in self:
@ -90,7 +101,7 @@ class ChecklistProgress(models.Model):
if activity.state in ['cancel', 'done', 'in_progress']: if activity.state in ['cancel', 'done', 'in_progress']:
total_completed += 1 total_completed += 1
if total_completed: if total_completed:
rec.progress = float(total_completed) / len( rec.progress = float(total_completed) / len(rec.checklists) * 100
rec.checklists) * 100
else: else:
rec.progress = 0.0 rec.progress = 0.0

1
projects_task_checklists/models/stage.py

@ -4,7 +4,6 @@
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: LINTO C T(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER # you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #

1
projects_task_checklists/security/ir.model.access.csv

@ -3,3 +3,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_checklist_activity_stages,access.checklist.activity.stages,model_checklist_activity_stages,,1,1,1,1 access_checklist_activity_stages,access.checklist.activity.stages,model_checklist_activity_stages,,1,1,1,1
access_task_checklist,access.task.checklist,model_task_checklist,,1,1,1,1 access_task_checklist,access.task.checklist,model_task_checklist,,1,1,1,1
access_checklist_item,access.checklist.item,model_checklist_item,,1,1,1,1 access_checklist_item,access.checklist.item,model_checklist_item,,1,1,1,1
access_checklist_item_line,access.checklist.item.line,model_checklist_item_line,,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_task_checklist access.task.checklist model_task_checklist 1 1 1 1
4 access_checklist_item access.checklist.item model_checklist_item 1 1 1 1
5 access_checklist_item_line access.checklist.item.line model_checklist_item_line 1 1 1 1
6

6
projects_task_checklists/views/checklist_add.xml

@ -17,14 +17,16 @@
<field name="inherit_id" ref="project.view_task_form2"/> <field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='tag_ids']" position="after"> <xpath expr="//field[@name='tag_ids']" position="after">
<field name="checklist_ids" invisible="1"/>
<field name="checklist_id"/> <field name="checklist_id"/>
</xpath> </xpath>
<xpath expr="//form/sheet/notebook/page[last()]" position="after"> <xpath expr="//form/sheet/notebook/page[last()]" position="after">
<page string="Checklist" attrs="{'invisible':[('checklist_id','=',False)]}"> <page string="Checklist" attrs="{'invisible':[('checklist_id','=',False)]}">
<field name="checklists"> <field name="checklists">
<tree> <tree decoration-danger="state=='cancel'" decoration-success="state=='done'"
<field name="name"/> decoration-info="state=='in_progress'" editable="bottom">
<field name="check_list_item_id"/>
<field name="description"/> <field name="description"/>
<button type="object" name="approve_and_next" class="text-success" icon="fa-check"/> <button type="object" name="approve_and_next" class="text-success" icon="fa-check"/>
<button type="object" name="mark_completed" icon="fa-check-circle" class="text-success"/> <button type="object" name="mark_completed" icon="fa-check-circle" class="text-success"/>

13
projects_task_checklists/views/checklist_menu.xml

@ -25,6 +25,7 @@
</group> </group>
<group> <group>
<field name="project_id"/> <field name="project_id"/>
<field name="task_ids" invisible="1"/>
</group> </group>
</group> </group>
@ -47,16 +48,6 @@
<field name="model">checklist.item</field> <field name="model">checklist.item</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Checklist Item"> <form string="Checklist Item">
<header>
<button type="object" name="approve_and_next" class="text-success"
string="Approve" icon="fa-check" states='todo,in_progress'/>
<button type="object" name="mark_completed" icon="fa-check-circle" class="text-success"
string="Completed"/>
<button type="object" name="mark_canceled" icon="fa-times" class="text-danger"
string="Canceled"/>
<button type="object" name="reset_stage" class="text-danger" string="Reset"/>
<field name="state" widget="statusbar"/>
</header>
<sheet> <sheet>
<group> <group>
<group> <group>
@ -140,4 +131,4 @@
action="task_checklist_action" action="task_checklist_action"
sequence="1"/> sequence="1"/>
</odoo> </odoo>
Loading…
Cancel
Save