Browse Source

July 22: [FIX] Bug Fixed 'document_approval'

pull/331/head
RisvanaCybro 9 months ago
parent
commit
6747639e7f
  1. 2
      document_approval/__manifest__.py
  2. 6
      document_approval/doc/RELEASE_NOTES.md
  3. 12
      document_approval/models/document_approval.py
  4. 2
      document_approval/models/document_approval_step.py
  5. 2
      document_approval/security/document_approval_security.xml
  6. BIN
      document_approval/static/description/assets/screenshots/16.png
  7. BIN
      document_approval/static/description/assets/screenshots/17.png
  8. BIN
      document_approval/static/description/assets/screenshots/18.png
  9. BIN
      document_approval/static/description/assets/screenshots/19.png
  10. BIN
      document_approval/static/description/assets/screenshots/20.png
  11. BIN
      document_approval/static/description/assets/screenshots/21.png
  12. BIN
      document_approval/static/description/assets/screenshots/22.png
  13. 142
      document_approval/static/description/index.html
  14. 4
      document_approval/views/document_approval_team_views.xml
  15. 2
      document_approval/views/document_approval_views.xml
  16. 6
      document_approval/wizards/document_reject.py

2
document_approval/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': "Document Approval",
"version": "17.0.1.0.0",
"version": "17.0.1.0.1",
"category": "Documents Management",
"summary": "Manager can approve or reject documents",
"description": "User can create and upload various document for approvals."

6
document_approval/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 17.0.1.0.0
#### ADD
- Initial commit for Document Approval
#### 22.07.2024
#### Version 17.0.1.0.1
#### BUG FIX
- Bug Fix

12
document_approval/models/document_approval.py

@ -20,7 +20,7 @@
#
#############################################################################
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.exceptions import UserError, ValidationError
class DocumentApproval(models.Model):
@ -43,6 +43,9 @@ class DocumentApproval(models.Model):
team_id = fields.Many2one('document.approval.team', string="Approval Team",
required=True,
help='Set which team is approving the document.')
team_lead_id = fields.Many2one(string='Team leader',
related='team_id.team_lead_id',
help="team Leader")
method = fields.Selection(selection=[('button', 'Button'),
('sign', 'Signature')],
default='button', string="Method",
@ -97,6 +100,13 @@ class DocumentApproval(models.Model):
'note': step.note
})]
@api.constrains('team_id')
def _check_team_member(self):
"""function to check whether the team has atleast one member."""
if not self.team_id.step_ids.approver_id:
raise ValidationError(
"Your Team member should atleast have one Approver.")
@api.depends('team_id')
def _compute_show_approve(self):
"""This method _compute_show_approve to compute the valur to the field

2
document_approval/models/document_approval_step.py

@ -52,6 +52,6 @@ class DocumentApprovalSteps(models.Model):
note = fields.Char(string='Notes', help="To add notes")
current_state = fields.Selection(
selection=[('upcoming', 'Upcoming'), ('pending', 'Pending'),
('approved', 'Approved')],
('approved', 'Approved'), ('rejected', 'Rejected')],
default="upcoming", string="Approval State",
help="THe current state of approval")

2
document_approval/security/document_approval_security.xml

@ -6,7 +6,7 @@
<field name="model_id"
ref="document_approval.model_document_approval"/>
<field name="domain_force">
['|',('step_ids.approver_id.id','=',user.id),('approve_initiator_id','=',user.id)]
['|','|',('step_ids.approver_id.id','=',user.id),('approve_initiator_id','=',user.id),('team_id.team_lead_id.id','=',user.id)]
</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>

BIN
document_approval/static/description/assets/screenshots/16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
document_approval/static/description/assets/screenshots/17.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
document_approval/static/description/assets/screenshots/18.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
document_approval/static/description/assets/screenshots/19.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
document_approval/static/description/assets/screenshots/20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
document_approval/static/description/assets/screenshots/21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
document_approval/static/description/assets/screenshots/22.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

142
document_approval/static/description/index.html

@ -47,7 +47,8 @@
#1A202C;">
Document Approval</h1>
<p class="my-3 mb-4"
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;">Approve or Reject Various Documents.
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;">
Approve or Reject Various Documents.
</p>
<div style="width: 80%; margin-top: 3rem;">
<img src="assets/screenshots/hero.gif"
@ -75,7 +76,8 @@
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">Approve or Reject Various Documents. </p>
font-size: 1.2rem; margin-bottom: 2px;">
Approve or Reject Various Documents. </p>
</div>
</div>
</div>
@ -109,7 +111,7 @@
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Set Various Steps for Approving.</p>
Set Various Steps for Approving.</p>
</div>
</div>
</div>
@ -126,7 +128,7 @@
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Signature Approval.</p>
Signature Approval.</p>
</div>
</div>
</div>
@ -221,7 +223,8 @@
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Approval Form View. Click on the 'Send for Approval' Button for Approval Request.</h4>
Approval Form View. Click on the 'Send for
Approval' Button for Approval Request.</h4>
</div>
</div>
</div>
@ -239,9 +242,13 @@
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Button Approval.</h4>
<p class="m-0" style="color:#718096">
After sending the approval request using the 'Button' method, clicking on the 'Approve'
button triggers a wizard to add a description for the approval. Upon adding the description,
clicking the 'Approve' button finalizes the approval process.
After sending the approval request using the
'Button' method, clicking on the 'Approve'
button triggers a wizard to add a
description for the approval. Upon adding
the description,
clicking the 'Approve' button finalizes the
approval process.
</p>
</div>
</div>
@ -262,6 +269,87 @@
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/16.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Step Wise Approval</h4>
<p class="mt-2"
style=" !important; color:#282F33 !important; font-size:1rem !important">
We can Configure A team for step-wise
approval</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/17.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<p class="mt-2"
style=" !important; color:#282F33 !important; font-size:1rem !important">
We can create an Approval And check the work
flow</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/18.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<p class="mt-2"
style=" !important; color:#282F33 !important; font-size:1rem !important">
If the Team Lead Approves the request, it
Will directly go to Approved Stage.</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/19.png"
class="img-responsive" width="100%"
height="auto">
<img src="assets/screenshots/20.png"
class="img-responsive" width="100%"
height="auto">
<img src="assets/screenshots/21.png"
class="img-responsive" width="100%"
height="auto">
<img src="assets/screenshots/22.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<p class="mt-2"
style=" !important; color:#282F33 !important; font-size:1rem !important">
Team members will be assigned approval
requests based on the structured sequence of
steps.</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
@ -289,9 +377,15 @@
</div>
<div class="px-3">
<p class="m-0" style="color:#718096">
After sending the approval request using the 'Signature' method, clicking on the 'Approve'
button prompts a wizard to input a description and add a signature for the approval. Once
the description and signature are provided, clicking the 'Approve' button completes the approval process.
After sending the approval request using the
'Signature' method, clicking on the
'Approve'
button prompts a wizard to input a
description and add a signature for the
approval. Once
the description and signature are provided,
clicking the 'Approve' button completes the
approval process.
</p>
</div>
</div>
@ -308,7 +402,8 @@
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
After confirming the approval the state is changed to the 'Approved'.</h4>
After confirming the approval the state is
changed to the 'Approved'.</h4>
</div>
</div>
</div>
@ -340,7 +435,8 @@
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
We can add the Description/Reason for the Approval Rejection.</h4>
We can add the Description/Reason for the
Approval Rejection.</h4>
</div>
</div>
</div>
@ -372,7 +468,8 @@
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Document Signature Approval Description.</h4>
Document Signature Approval
Description.</h4>
</div>
</div>
</div>
@ -417,21 +514,24 @@
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Approve or Reject Various Documents.
width="16px"></span>Approve or
Reject Various Documents.
</li>
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Set Different Team for Approvals.
width="16px"></span>Set Different
Team for Approvals.
</li>
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Set Various Steps for Approving.
width="16px"></span>Set Various
Steps for Approving.
</li>
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
@ -454,14 +554,16 @@
</div>
<div id="tab3" class="tab-pane fade">
<div class="col-mg-12 active" style="padding: 1rem 4rem;">
<div class="py-3" style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3"
style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span
class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:01st Apr 2024</span>
</div>
<p class="m-0" style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial commit for Document Approval</p>
</div>
</div>
@ -524,7 +626,7 @@
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Size Restriction For Attachments</p>
Size Restriction For Attachments</p>
</div>
</a>
</div>

4
document_approval/views/document_approval_team_views.xml

@ -31,10 +31,10 @@
<group name="approvers" string="Approvers">
<field name="step_ids" nolabel="1" colspan="2">
<tree editable="bottom">
<field name="steps" style="text-align: {left};"/>
<field name="steps"
style="text-align: {left};"/>
<field name="approver_id"/>
<field name="role"/>
<field name="state"/>
<field name="note"/>
</tree>
</field>

2
document_approval/views/document_approval_views.xml

@ -73,6 +73,7 @@
</group>
<group name="approval" string="Approval">
<field name="team_id" readonly="state == 'approved'"/>
<field name="team_lead_id"/>
<field name="method" readonly="state != 'draft'"/>
<field name="step_count"/>
<field name="show_approve" invisible="1"/>
@ -94,6 +95,7 @@
decoration-success="current_state == 'approved'"
decoration-primary="current_state == 'pending'"
decoration-warning="current_state == 'upcoming'"
decoration-danger="current_state == 'rejected'"
column_invisible="parent.state == 'draft'"/>
<field name="note"/>
</tree>

6
document_approval/wizards/document_reject.py

@ -36,3 +36,9 @@ class DocumentReject(models.TransientModel):
def action_reject_document(self):
""" Function to reject document"""
self.document_id.state = "reject"
for rec in self.document_id.step_ids.filtered(
lambda x: x.approver_id.id == self.env.user.id):
rec.write({
'current_state': 'rejected',
})

Loading…
Cancel
Save