Skip to content

Commit 0de7834

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 0de7834

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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 {

0 commit comments

Comments
 (0)