forked from Techsystech/web
commit
6c3f453a0f
|
@ -1,6 +1,8 @@
|
||||||
# Copyright (C) 2023-Today: GRAP (<http://www.grap.coop/>)
|
# Copyright (C) 2023-Today: GRAP (<http://www.grap.coop/>)
|
||||||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
# pylint: disable=C7902
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openupgradelib import openupgrade
|
from openupgradelib import openupgrade
|
||||||
|
|
|
@ -10,7 +10,7 @@ from dateutil.relativedelta import relativedelta
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.tools.safe_eval import safe_eval as eval
|
from odoo.tools.safe_eval import safe_eval
|
||||||
from odoo.tools.translate import _
|
from odoo.tools.translate import _
|
||||||
from odoo.exceptions import ValidationError, except_orm
|
from odoo.exceptions import ValidationError, except_orm
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ class TileTile(models.Model):
|
||||||
eval_context = self._get_eval_context()
|
eval_context = self._get_eval_context()
|
||||||
domain = tile.domain or "[]"
|
domain = tile.domain or "[]"
|
||||||
try:
|
try:
|
||||||
count = model.search_count(eval(domain, eval_context))
|
count = model.search_count(safe_eval(domain, eval_context))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tile.primary_value = 0.0
|
tile.primary_value = 0.0
|
||||||
tile.primary_formated_value =\
|
tile.primary_formated_value =\
|
||||||
|
@ -216,7 +216,7 @@ class TileTile(models.Model):
|
||||||
]
|
]
|
||||||
read_vals = (
|
read_vals = (
|
||||||
fields
|
fields
|
||||||
and model.search_read(eval(domain, eval_context), fields)
|
and model.search_read(safe_eval(domain, eval_context), fields)
|
||||||
or []
|
or []
|
||||||
)
|
)
|
||||||
for f in ["primary_", "secondary_"]:
|
for f in ["primary_", "secondary_"]:
|
||||||
|
@ -261,13 +261,13 @@ class TileTile(models.Model):
|
||||||
f_helper = f + "helper"
|
f_helper = f + "helper"
|
||||||
tile[f_helper] = ""
|
tile[f_helper] = ""
|
||||||
field_func = FIELD_FUNCTIONS.get(tile[f_function], {})
|
field_func = FIELD_FUNCTIONS.get(tile[f_function], {})
|
||||||
help = field_func.get("help", False)
|
help_text = field_func.get("help", False)
|
||||||
if help:
|
if help_text:
|
||||||
if tile[f_function] != "count" and tile[f_field_id]:
|
if tile[f_function] != "count" and tile[f_field_id]:
|
||||||
desc = tile[f_field_id].field_description
|
desc = tile[f_field_id].field_description
|
||||||
tile[f_helper] = help % desc
|
tile[f_helper] = help_text % desc
|
||||||
else:
|
else:
|
||||||
tile[f_helper] = help
|
tile[f_helper] = help_text
|
||||||
|
|
||||||
def _compute_active(self):
|
def _compute_active(self):
|
||||||
ima = self.env["ir.model.access"]
|
ima = self.env["ir.model.access"]
|
||||||
|
|
|
@ -12,3 +12,4 @@ you can write the following code to reduce the load duration of the tree view.
|
||||||
.. code:: xml
|
.. code:: xml
|
||||||
|
|
||||||
<field name="image_small" widget="image" options="{'tooltip_image': 'image'}"/>
|
<field name="image_small" widget="image" options="{'tooltip_image': 'image'}"/>
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,3 @@
|
||||||
* Meet Dholakia <m.dholakia.serpentcs@gmail.com>
|
* Meet Dholakia <m.dholakia.serpentcs@gmail.com>
|
||||||
* Nikul Chaudhary <nikul.chaudhary.serpentcs@gmail.com>
|
* Nikul Chaudhary <nikul.chaudhary.serpentcs@gmail.com>
|
||||||
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
|
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue