Skip to content

Commit

Permalink
[IMP] base_tier_validation: Add validation_status field to tier.valid…
Browse files Browse the repository at this point in the history
…ation

TT33369
  • Loading branch information
victoralmau committed Oct 17, 2023
1 parent a4afb7e commit 8f38412
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 56 deletions.
31 changes: 20 additions & 11 deletions base_tier_validation/i18n/base_tier_validation.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-17 15:04+0000\n"
"PO-Revision-Date: 2023-10-17 15:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -304,16 +306,6 @@ msgid ""
"definition is triggered."
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_uid
msgid "Last Archived by"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_date
msgid "Last Archived on"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard____last_update
#: model:ir.model.fields,field_description:base_tier_validation.field_res_config_settings____last_update
Expand Down Expand Up @@ -419,6 +411,7 @@ msgstr ""
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/systray.xml:0
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__pending
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__pending
#, python-format
msgid "Pending"
msgstr ""
Expand All @@ -436,6 +429,7 @@ msgstr ""
#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__rejected
msgid "Rejected"
msgstr ""

Expand Down Expand Up @@ -531,7 +525,6 @@ msgstr ""
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/tier_review_template.xml:0
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__sequence
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
#, python-format
msgid "Sequence"
msgstr ""
Expand Down Expand Up @@ -582,6 +575,11 @@ msgid ""
"Please request a validation."
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
msgid "Tier"
msgstr ""

#. module: base_tier_validation
#: model:ir.actions.act_window,name:base_tier_validation.tier_definition_action
#: model:ir.model,name:base_tier_validation.model_tier_definition
Expand Down Expand Up @@ -691,6 +689,7 @@ msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validated
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__validated
msgid "Validated"
msgstr ""

Expand All @@ -713,11 +712,21 @@ msgstr ""
msgid "Validation Date"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validation_status
msgid "Validation Status"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__review_ids
msgid "Validations"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__no
msgid "Without validation"
msgstr ""

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_definition_view_form
msgid "e.g. Tier Validation for..."
Expand Down
77 changes: 32 additions & 45 deletions base_tier_validation/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-16 11:46+0000\n"
"POT-Creation-Date: 2023-10-17 15:04+0000\n"
"PO-Revision-Date: 2023-10-17 17:06+0200\n"
"Last-Translator: Ana Suárez <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
"X-Generator: Poedit 3.0.1\n"

#. module: base_tier_validation
#. openerp-web
Expand Down Expand Up @@ -218,8 +219,9 @@ msgstr "Compañía"

#. module: base_tier_validation
#: model:ir.model,name:base_tier_validation.model_res_config_settings
#, fuzzy
msgid "Config Settings"
msgstr ""
msgstr "Ajustes de configuración"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__create_uid
Expand Down Expand Up @@ -323,16 +325,6 @@ msgstr ""
"Si está establecido, todos los posibles validadores serán notificados por "
"email cuando esta definición se ejecute."

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_uid
msgid "Last Archived by"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_date
msgid "Last Archived on"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard____last_update
#: model:ir.model.fields,field_description:base_tier_validation.field_res_config_settings____last_update
Expand Down Expand Up @@ -439,6 +431,7 @@ msgstr ""
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/systray.xml:0
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__pending
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__pending
#, python-format
msgid "Pending"
msgstr "Pendiente"
Expand All @@ -456,6 +449,7 @@ msgstr "Rechazar"
#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__rejected
msgid "Rejected"
msgstr "Rechazado"

Expand Down Expand Up @@ -495,19 +489,19 @@ msgstr "Solicitado Por"
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__res_id
#, fuzzy
msgid "Res"
msgstr "Revisiones"
msgstr "Historial de límite de crédito de contacto"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__res_model
#, fuzzy
msgid "Res Model"
msgstr "Modelo"
msgstr "Res model"

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_validation_buttons
#, fuzzy
msgid "Restart Validation"
msgstr "Volver a empezar validación"
msgstr "Reiniciar Validación"

#. module: base_tier_validation
#. openerp-web
Expand Down Expand Up @@ -554,7 +548,6 @@ msgstr "Revisiones"
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/tier_review_template.xml:0
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__sequence
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
#, python-format
msgid "Sequence"
msgstr "Secuencia"
Expand Down Expand Up @@ -600,11 +593,17 @@ msgstr ""
#: code:addons/base_tier_validation/models/tier_validation.py:0
#, python-format
msgid ""
"This action needs to be validated for at least one record. Reviews pending:\n"
"This action needs to be validated for at least one record. Reviews "
"pending:\n"
" - %s \n"
"Please request a validation."
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
msgid "Tier"
msgstr "Nivel"

#. module: base_tier_validation
#: model:ir.actions.act_window,name:base_tier_validation.tier_definition_action
#: model:ir.model,name:base_tier_validation.model_tier_definition
Expand Down Expand Up @@ -642,8 +641,9 @@ msgstr ""

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.res_config_settings_view_form_budget
#, fuzzy
msgid "Tier Validation"
msgstr ""
msgstr "Nueva Validación de Nivel"

#. module: base_tier_validation
#: model:ir.model,name:base_tier_validation.model_tier_validation
Expand Down Expand Up @@ -707,7 +707,7 @@ msgstr ""
#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_validation_label
msgid "Validate"
msgstr ""
msgstr "Validado"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__validate_reject
Expand All @@ -717,6 +717,7 @@ msgstr "Validado"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validated
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__validated
msgid "Validated"
msgstr "Validado"

Expand All @@ -739,36 +740,22 @@ msgstr "Validado por"
msgid "Validation Date"
msgstr "Fecha de Validación"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validation_status
msgid "Validation Status"
msgstr "Estado de validación"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__review_ids
msgid "Validations"
msgstr "Validaciones"

#. module: base_tier_validation
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__no
msgid "Without validation"
msgstr "Sin validación"

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_definition_view_form
msgid "e.g. Tier Validation for..."
msgstr "ej. Validación de Nivel por..."

#~ msgid ""
#~ "This action needs to be validated for at least one record. \n"
#~ "Please request a validation."
#~ msgstr ""
#~ "Esta acción necesita ser validada para algún registro.\n"
#~ "Por favor, solicita una validación."

#~ msgid "Any user in a specific group."
#~ msgstr "Cualquier usuario en el grupo especificado."

#~ msgid "Tier"
#~ msgstr "Nivel"

#, fuzzy
#~| msgid "Sequence"
#~ msgid "Approve Sequence"
#~ msgstr "Secuencia"

#~ msgid "Formula"
#~ msgstr "Fórmula"

#~ msgid "Python Expression"
#~ msgstr "Expresión Python"
21 changes: 21 additions & 0 deletions base_tier_validation/models/tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class TierValidation(models.AbstractModel):
compute="_compute_validated_rejected", search="_search_rejected"
)
rejected_message = fields.Html(compute="_compute_validated_rejected")
validation_status = fields.Selection(
selection=[
("no", "Without validation"),
("pending", "Pending"),
("rejected", "Rejected"),
("validated", "Validated"),
],
default="no",
compute="_compute_validation_status",
)
reviewer_ids = fields.Many2many(
string="Reviewers",
comodel_name="res.users",
Expand Down Expand Up @@ -171,6 +181,17 @@ def _compute_validated_rejected(self):
rec.rejected_message = rec._get_rejected_message()
rec.to_validate_message = rec._get_to_validate_message()

def _compute_validation_status(self):
for item in self:
if any(item.review_ids.filtered(lambda x: x.status == "pending")):
item.validation_status = "pending"

Check warning on line 187 in base_tier_validation/models/tier_validation.py

View check run for this annotation

Codecov / codecov/patch

base_tier_validation/models/tier_validation.py#L187

Added line #L187 was not covered by tests
elif item.validated:
item.validation_status = "validated"

Check warning on line 189 in base_tier_validation/models/tier_validation.py

View check run for this annotation

Codecov / codecov/patch

base_tier_validation/models/tier_validation.py#L189

Added line #L189 was not covered by tests
elif item.rejected:
item.validation_status = "rejected"

Check warning on line 191 in base_tier_validation/models/tier_validation.py

View check run for this annotation

Codecov / codecov/patch

base_tier_validation/models/tier_validation.py#L191

Added line #L191 was not covered by tests
else:
item.validation_status = "no"

Check warning on line 193 in base_tier_validation/models/tier_validation.py

View check run for this annotation

Codecov / codecov/patch

base_tier_validation/models/tier_validation.py#L193

Added line #L193 was not covered by tests

def _compute_next_review(self):
for rec in self:
review = rec.review_ids.sorted("sequence").filtered(
Expand Down

0 comments on commit 8f38412

Please sign in to comment.