Automatic Update form OCA2FC Migrator

This commit is contained in:
Flectra Community Bot 2021-10-03 02:12:30 +00:00 committed by OCA2FC Migrator Bot
parent ab3d60c07c
commit b9577103ac
3 changed files with 26 additions and 33 deletions

View File

@ -22,7 +22,7 @@ addon | version | summary
[multi_step_wizard](multi_step_wizard/) | 2.0.1.0.0| Multi-Steps Wizards [multi_step_wizard](multi_step_wizard/) | 2.0.1.0.0| Multi-Steps Wizards
[base_technical_features](base_technical_features/) | 2.0.1.1.0| Access to technical features without activating debug mode [base_technical_features](base_technical_features/) | 2.0.1.1.0| Access to technical features without activating debug mode
[base_tier_validation_formula](base_tier_validation_formula/) | 2.0.2.0.0| Formulas for Base tier validation [base_tier_validation_formula](base_tier_validation_formula/) | 2.0.2.0.0| Formulas for Base tier validation
[base_tier_validation](base_tier_validation/) | 2.0.2.5.0| Implement a validation process based on tiers. [base_tier_validation](base_tier_validation/) | 2.0.2.5.1| 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_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_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 [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", "name": "Base Tier Validation",
"summary": "Implement a validation process based on tiers.", "summary": "Implement a validation process based on tiers.",
"version": "2.0.2.5.0", "version": "2.0.2.5.1",
"development_status": "Mature", "development_status": "Mature",
"maintainers": ["LoisRForgeFlow"], "maintainers": ["LoisRForgeFlow"],
"category": "Tools", "category": "Tools",

View File

@ -12,37 +12,30 @@ class Users(models.Model):
@api.model @api.model
def review_user_count(self): def review_user_count(self):
user_reviews = {} user_reviews = {}
to_review_docs = {} domain = [
reviews = self.env["tier.review"].search(
[
("status", "=", "pending"), ("status", "=", "pending"),
("can_review", "=", True), ("can_review", "=", True),
("id", "in", self.env.user.review_ids.ids), ("id", "in", self.env.user.review_ids.ids),
] ]
) review_groups = self.env["tier.review"].read_group(domain, ["model"], ["model"])
for review in reviews: for review_group in review_groups:
record = ( model = review_group["model"]
review.env[review.model] reviews = self.env["tier.review"].search(review_group.get("__domain"))
if reviews:
records = (
self.env[model]
.with_user(self.env.user) .with_user(self.env.user)
.search([("id", "=", review.res_id)]) .search([("id", "in", reviews.mapped("res_id"))])
.filtered(lambda x: not x.rejected and x.can_review)
) )
if not record or record.rejected or not record.can_review: if len(records):
# Checking that the review is accessible with the permissions record = self.env[model]
# and to review condition is valid user_reviews[model] = {
continue
if not user_reviews.get(review["model"]):
user_reviews[review.model] = {
"name": record._description, "name": record._description,
"model": review.model, "model": model,
"icon": modules.module.get_module_icon( "icon": modules.module.get_module_icon(record._original_module),
self.env[review.model]._original_module "pending_count": len(records),
),
"pending_count": 0,
} }
docs = to_review_docs.get(review.model)
if (docs and record not in docs) or not docs:
user_reviews[review.model]["pending_count"] += 1
to_review_docs.setdefault(review.model, []).append(record)
return list(user_reviews.values()) return list(user_reviews.values())
@api.model @api.model