Skip to content

Commit

Permalink
[MIG] report_qweb_parameter: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiadavid committed Jan 23, 2025
1 parent 1ee9db4 commit fae20e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion report_qweb_parameter/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Report QWeb Parameter",
"version": "17.0.1.0.1",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"summary": """
Add new parameters for qweb templates in order to reduce field length
Expand Down
4 changes: 2 additions & 2 deletions report_qweb_parameter/demo/test_report_field_length.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name="esc_length"
t-minlength="10"
t-length="10"
t-esc="docs[0].street"
t-out="docs[0].street"
t-if="docs[0].street"
/>
<li
Expand All @@ -23,7 +23,7 @@
<li
name="esc_maxlength"
t-maxlength="10"
t-esc="docs[0].website"
t-out="docs[0].website"
t-if="docs[0].website"
/>
<li
Expand Down
10 changes: 5 additions & 5 deletions report_qweb_parameter/models/ir_qweb.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Copyright 2017 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, models
from odoo import models
from odoo.exceptions import ValidationError


class IrQWeb(models.AbstractModel):
_inherit = "ir.qweb"

@staticmethod
def check_length(value, min_length=False, max_length=False):
def check_length(self, value, min_length=False, max_length=False): # noqa
"""No use staticmethod because self is needed to translate exception messages"""
if min_length and len(value) < min_length:
raise ValidationError(_("Length cannot be less than %s") % str(min_length))
raise ValidationError(self.env._("Length cannot be less than %s") % str(min_length))
if max_length and len(value) > max_length:
raise ValidationError(_("Length cannot be more than %s") % str(max_length))
raise ValidationError(self.env._("Length cannot be more than %s") % str(max_length))
return value

def _compile_directive_esc(self, el, compile_context, level):
Expand Down

0 comments on commit fae20e5

Please sign in to comment.