Skip to content

Commit

Permalink
[18.0][MIG] account_move_tier_validation_approver: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Nov 11, 2024
1 parent 2436504 commit 02aba64
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 27 deletions.
3 changes: 3 additions & 0 deletions account_move_tier_validation_approver/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ Contributors

- Lois Rilo <lois.rilo@forgeflow.com>
- Adrià Gil Sorribes <adria.gil@forgeflow.com>
- [360ERP](https://www.360erp.com):

- Kevin Khao <<kevinkhao@gmail.com>>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion account_move_tier_validation_approver/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Move Tier Validation Approver",
"version": "15.0.1.0.0",
"version": "18.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Accounting",
"license": "AGPL-3",
Expand Down
4 changes: 2 additions & 2 deletions account_move_tier_validation_approver/models/account_move.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2021 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import UserError


Expand All @@ -26,7 +26,7 @@ def _post(self, soft=True):
and not move.approver_id
):
raise UserError(

Check warning on line 28 in account_move_tier_validation_approver/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_tier_validation_approver/models/account_move.py#L28

Added line #L28 was not covered by tests
_(
self.env._(
"It is mandatory to indicate a Responsible for Approval (in {})"
).format(move.name)
)
Expand Down
2 changes: 2 additions & 0 deletions account_move_tier_validation_approver/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
- Lois Rilo \<<lois.rilo@forgeflow.com>\>
- Adrià Gil Sorribes \<<adria.gil@forgeflow.com>\>
- \[360ERP\](<https://www.360erp.com>):
- Kevin Khao \<\<<kevinkhao@gmail.com>\>\>
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Adrià Gil Sorribes &lt;<a class="reference external" href="mailto:adria.gil&#64;forgeflow.com">adria.gil&#64;forgeflow.com</a>&gt;</li>
<li>[360ERP](<a class="reference external" href="https://www.360erp.com">https://www.360erp.com</a>):<ul>
<li>Kevin Khao &lt;&lt;<a class="reference external" href="mailto:kevinkhao&#64;gmail.com">kevinkhao&#64;gmail.com</a>&gt;&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

class TestAccountMoveTierValidationApprover(TransactionCase):
def setUp(self):
super(TestAccountMoveTierValidationApprover, self).setUp()
super().setUp()
self.res_partner_1 = self.env["res.partner"].create(
{"name": "Wood Corner", "email": "example@yourcompany.com"}
)
self.product_1 = self.env["product.product"].create(
{"name": "Desk Combination"}
)
self.currency_euro = self.env["res.currency"].search([("name", "=", "EUR")])
self.currency_usd = self.env["res.currency"].search([("name", "=", "USD")])
self.test_user_1 = self.env["res.users"].create(
{"name": "User", "login": "test1", "email": "example@yourcompany.com"}
)
Expand All @@ -26,7 +26,7 @@ def setUp(self):
{
"move_type": "in_invoice",
"partner_id": self.res_partner_1.id,
"currency_id": self.currency_euro.id,
"currency_id": self.currency_usd.id,
"approver_id": self.test_approver.id,
"invoice_line_ids": [
(
Expand Down Expand Up @@ -69,7 +69,6 @@ def test_field_validation_approver(self):
{"approver_id": self.test_approver.id, "invoice_date": record.date}
)
record.with_user(self.test_user_1.id).request_validation()
record.invalidate_cache()
record.with_user(self.test_user_1.id).validate_tier()
with self.assertRaises(ValidationError):
record.action_post()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<xpath expr='//field[@name="ref"]' position="after">
<field
name="approver_id"
attrs="{'readonly': [('review_ids', '!=', [])], 'invisible': [('move_type', 'in', ['out_invoice', 'out_refund', 'entry'])]}"
readonly="review_ids != False"
invisible="move_type in ('out_invoice', 'out_refund', 'entry')"
/>
</xpath>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,14 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='account_vendor_bills']" position="inside">
<div
class="col-12 col-lg-6 o_setting_box"
id="account_config_require_approver_in_vendor_bills"
<xpath expr="//block[@id='account_vendor_bills']" position="inside">
<setting
id="autopost_bills"
help="Require approver before posting vendor bills. Values set here are company-specific."
groups="base.group_multi_company"
>
<div class="o_setting_left_pane">
<field name="require_approver_in_vendor_bills" />
</div>
<div class="o_setting_right_pane">
<label for="require_approver_in_vendor_bills" />
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
groups="base.group_multi_company"
/>
<div class="text-muted">
Require approver before posting vendor bills
</div>
</div>
</div>
<field name="autopost_bills" />
</setting>
</xpath>
</field>
</record>
Expand Down
2 changes: 2 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
odoo-addon-base_tier_validation @ git+https://github.com/OCA/server-ux.git@refs/pull/966/head#subdirectory=base_tier_validation
odoo-addon-account_move_tier_validation @ git+https://github.com/OCA/account-invoicing.git@refs/pull/1830/head#subdirectory=account_move_tier_validation

0 comments on commit 02aba64

Please sign in to comment.