Automatic Update form OCA2FC Migrator

This commit is contained in:
Flectra Community Bot 2021-12-26 03:14:27 +00:00 committed by OCA2FC Migrator Bot
parent 348a066d66
commit 76ce7abce9
3 changed files with 12 additions and 5 deletions

View File

@ -23,7 +23,7 @@ addon | version | summary
[multi_step_wizard](multi_step_wizard/) | 2.0.1.0.0| Multi-Steps Wizards
[base_technical_features](base_technical_features/) | 2.0.1.1.1| Access to technical features without activating debug mode
[base_tier_validation_formula](base_tier_validation_formula/) | 2.0.2.0.1| Formulas for Base tier validation
[base_tier_validation](base_tier_validation/) | 2.0.2.7.0| Implement a validation process based on tiers.
[base_tier_validation](base_tier_validation/) | 2.0.2.8.0| Implement a validation process based on tiers.
[base_search_custom_field_filter](base_search_custom_field_filter/) | 2.0.1.0.0| Add custom filters for fields via UI
[base_revision](base_revision/) | 2.0.1.0.1| Keep track of revised document
[base_export_manager](base_export_manager/) | 2.0.1.0.1| Manage model export profiles

View File

@ -3,7 +3,7 @@
{
"name": "Base Tier Validation",
"summary": "Implement a validation process based on tiers.",
"version": "2.0.2.7.0",
"version": "2.0.2.8.0",
"development_status": "Mature",
"maintainers": ["LoisRForgeFlow"],
"category": "Tools",

View File

@ -193,6 +193,15 @@ class TierValidation(models.AbstractModel):
return False
return True
def _check_tier_state_transition(self, vals):
"""
Check we are in origin state and not destination state
"""
self.ensure_one()
return getattr(self, self._state_field) in self._state_from and not vals.get(
self._state_field
) in (self._state_to + [self._cancel_state])
def write(self, vals):
for rec in self:
if rec._check_state_conditions(vals):
@ -216,9 +225,7 @@ class TierValidation(models.AbstractModel):
)
if (
rec.review_ids
and getattr(rec, self._state_field) in self._state_from
and not vals.get(self._state_field)
in (self._state_to + [self._cancel_state])
and rec._check_tier_state_transition(vals)
and not rec._check_allow_write_under_validation(vals)
):
raise ValidationError(_("The operation is under validation."))