Skip to content

Commit

Permalink
[IMP] base_tier_validation: Add Validate + Reject buttons from Review…
Browse files Browse the repository at this point in the history
…s table

TT43351
  • Loading branch information
victoralmau committed Sep 6, 2023
1 parent 1b7a7c6 commit 607b772
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions base_tier_validation/models/tier_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,15 @@ def _get_reviewers(self):
if not reviewer_field or not reviewer_field._name == "res.users":
raise ValidationError(_("There are no res.users in the selected field"))
return reviewer_field

def validate_tier(self):
self.ensure_one()
record = self.env[self.model].browse(self.res_id)
record._validate_tier(tiers=self)
record._update_counter()

Check warning on line 118 in base_tier_validation/models/tier_review.py

View check run for this annotation

Codecov / codecov/patch

base_tier_validation/models/tier_review.py#L115-L118

Added lines #L115 - L118 were not covered by tests

def reject_tier(self):
self.ensure_one()
record = self.env[self.model].browse(self.res_id)
record._rejected_tier(tiers=self)
record._update_counter()

Check warning on line 124 in base_tier_validation/models/tier_review.py

View check run for this annotation

Codecov / codecov/patch

base_tier_validation/models/tier_review.py#L121-L124

Added lines #L121 - L124 were not covered by tests
19 changes: 19 additions & 0 deletions base_tier_validation/views/tier_review_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@
<field name="review_type" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="comment" position="after">
<field name="can_review" invisible="1" />
</field>
<tree position="inside">
<button
name="validate_tier"
type="object"
class="oe_inline oe_button btn-success"
icon="fa-thumbs-up"
attrs="{'invisible': [('can_review', '=', False)]}"
/>
<button
name="reject_tier"
type="object"
class="btn-icon btn-danger"
icon="fa-thumbs-down"
attrs="{'invisible': [('can_review', '=', False)]}"
/>
</tree>
</field>
</record>
</odoo>

0 comments on commit 607b772

Please sign in to comment.