Skip to content

Commit 0700288

Browse files
committed
[18.0][IMP] account_reconcile_model_oca: hide not implemented option.
Percentage of statment line was selectable, however process behind it is not implemented, it does nothing.
1 parent ec5fb15 commit 0700288

File tree

5 files changed

+55
-22
lines changed

5 files changed

+55
-22
lines changed

account_reconcile_model_oca/README.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
===========================
62
Account Reconcile Model Oca
73
===========================
@@ -17,7 +13,7 @@ Account Reconcile Model Oca
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
2218
:alt: License: LGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github

account_reconcile_model_oca/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Account Reconcile Model Oca",
66
"summary": """
77
This includes the logic moved from Odoo Community to Odoo Enterprise""",
8-
"version": "18.0.1.1.0",
8+
"version": "18.0.1.1.1",
99
"license": "LGPL-3",
1010
"author": "Dixmit,Odoo,Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/account-reconcile",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from odoo import SUPERUSER_ID, api
2+
3+
4+
def migrate(cr, version):
5+
env = api.Environment(cr, SUPERUSER_ID, {})
6+
reconciliation_model_lines = env["account.reconcile.model.line"].search(
7+
[("amount_type", "=", "percentage_st_line")]
8+
)
9+
env.add_to_compute(
10+
reconciliation_model_lines._fields["amount_type"], reconciliation_model_lines
11+
)

account_reconcile_model_oca/models/account_reconcile_model.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,38 @@ def _check_rule_propositions(self, st_line, amls_values_list):
820820
class AccountReconcileModelLine(models.Model):
821821
_inherit = "account.reconcile.model.line"
822822

823+
# TODO: remove this method if option 'percentage_st_line' is implemented
824+
# in the future
825+
@api.model
826+
def fields_get(self, allfields=None, attributes=None):
827+
"""Hide 'percentage_st_line' from amount_type selection in the UI.
828+
829+
'percentage_st_line' is not implemented, so we remove it from the selection
830+
options.
831+
"""
832+
res = super().fields_get(allfields=allfields, attributes=attributes)
833+
field_name = "amount_type"
834+
835+
if field_name in res and "selection" in res[field_name]:
836+
res[field_name]["selection"] = [
837+
(key, label)
838+
for key, label in res[field_name]["selection"]
839+
if key != "percentage_st_line"
840+
]
841+
return res
842+
843+
# TODO: remove this method if option 'percentage_st_line' is implemented
844+
# in the future
845+
@api.depends("rule_type", "model_id.counterpart_type")
846+
def _compute_amount_type(self):
847+
res = super()._compute_amount_type()
848+
# If the compute set 'percentage_st_line', change it to 'percentage'.
849+
# percentage_st_line type is not implemented.
850+
for line in self:
851+
if line.amount_type == "percentage_st_line":
852+
line.amount_type = "percentage"
853+
return res
854+
823855
def _get_write_off_move_line_dict(self, balance, currency):
824856
self.ensure_one()
825857
return {

account_reconcile_model_oca/static/description/index.html

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Account Reconcile Model Oca</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="account-reconcile-model-oca">
364+
<h1 class="title">Account Reconcile Model Oca</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="account-reconcile-model-oca">
370-
<h1>Account Reconcile Model Oca</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:e9c7a6cfd4551eb4633ea7002e159efbe119e3747062e4503679e7c0c5ad35e4
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/18.0/account_reconcile_model_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-18-0/account-reconcile-18-0-account_reconcile_model_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/18.0/account_reconcile_model_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-18-0/account-reconcile-18-0-account_reconcile_model_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>This module restores account reconciliation models functions moved from
379374
Odoo community to enterpise in V. 17.0</p>
380375
<p><strong>Table of contents</strong></p>
@@ -391,24 +386,24 @@ <h1>Account Reconcile Model Oca</h1>
391386
</ul>
392387
</div>
393388
<div class="section" id="bug-tracker">
394-
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
389+
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
395390
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-reconcile/issues">GitHub Issues</a>.
396391
In case of trouble, please check there if your issue has already been reported.
397392
If you spotted it first, help us to smash it by providing a detailed and welcomed
398393
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_model_oca%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
399394
<p>Do not contact contributors directly about support or help with technical issues.</p>
400395
</div>
401396
<div class="section" id="credits">
402-
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
397+
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
403398
<div class="section" id="authors">
404-
<h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
399+
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
405400
<ul class="simple">
406401
<li>Dixmit</li>
407402
<li>Odoo</li>
408403
</ul>
409404
</div>
410405
<div class="section" id="contributors">
411-
<h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
406+
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
412407
<ul class="simple">
413408
<li>Dixmit<ul>
414409
<li>Enric Tobella</li>
@@ -425,12 +420,12 @@ <h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
425420
</ul>
426421
</div>
427422
<div class="section" id="other-credits">
428-
<h3><a class="toc-backref" href="#toc-entry-5">Other credits</a></h3>
423+
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
429424
<p>The migration of this module from 17.0 to 18.0 was financially supported
430425
by Camptocamp.</p>
431426
</div>
432427
<div class="section" id="maintainers">
433-
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
428+
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
434429
<p>This module is maintained by the OCA.</p>
435430
<a class="reference external image-reference" href="https://odoo-community.org">
436431
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -443,6 +438,5 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
443438
</div>
444439
</div>
445440
</div>
446-
</div>
447441
</body>
448442
</html>

0 commit comments

Comments
 (0)