mirror of
https://github.com/bringout/oca-ocb-vertical-industry.git
synced 2026-04-22 13:52:08 +02:00
19.0 vanilla
This commit is contained in:
parent
4607ccbd2e
commit
825ff6514e
487 changed files with 184979 additions and 195262 deletions
|
|
@ -7,7 +7,7 @@ from odoo.tools.safe_eval import safe_eval
|
|||
DOMAIN_TEMPLATE = "[('store', '=', True), '|', ('model_id', '=', model_id), ('model_id', 'in', model_inherited_ids)%s]"
|
||||
|
||||
|
||||
class GoalDefinition(models.Model):
|
||||
class GamificationGoalDefinition(models.Model):
|
||||
"""Goal definition
|
||||
|
||||
A goal definition contains the way to evaluate an objective
|
||||
|
|
@ -91,7 +91,11 @@ class GoalDefinition(models.Model):
|
|||
msg = e
|
||||
if isinstance(e, SyntaxError):
|
||||
msg = (e.msg + '\n' + e.text)
|
||||
raise exceptions.UserError(_("The domain for the definition %s seems incorrect, please check it.\n\n%s") % (definition.name, msg))
|
||||
raise exceptions.UserError(_(
|
||||
"The domain for the definition %(definition)s seems incorrect, please check it.\n\n%(error_message)s",
|
||||
definition=definition.name,
|
||||
error_message=msg,
|
||||
))
|
||||
return True
|
||||
|
||||
def _check_model_validity(self):
|
||||
|
|
@ -118,7 +122,7 @@ class GoalDefinition(models.Model):
|
|||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
definitions = super(GoalDefinition, self).create(vals_list)
|
||||
definitions = super().create(vals_list)
|
||||
definitions.filtered_domain([
|
||||
('computation_mode', 'in', ['count', 'sum']),
|
||||
])._check_domain_validity()
|
||||
|
|
@ -128,7 +132,7 @@ class GoalDefinition(models.Model):
|
|||
return definitions
|
||||
|
||||
def write(self, vals):
|
||||
res = super(GoalDefinition, self).write(vals)
|
||||
res = super().write(vals)
|
||||
if vals.get('computation_mode', 'count') in ('count', 'sum') and (vals.get('domain') or vals.get('model_id')):
|
||||
self._check_domain_validity()
|
||||
if vals.get('field_id') or vals.get('model_id') or vals.get('batch_mode'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue