diff --git a/README.md b/README.md index cba7e01..77c8df5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/base_tier_validation/__manifest__.py b/base_tier_validation/__manifest__.py index 059e5ad..9acc2ca 100644 --- a/base_tier_validation/__manifest__.py +++ b/base_tier_validation/__manifest__.py @@ -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", diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py index e95c9ad..9ab39c7 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -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."))