diff --git a/README.md b/README.md index 8d81d3c..265ee21 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ addon | version | summary [base_optional_quick_create](base_optional_quick_create/) | 3.0.1.0.0| Avoid "quick create" on m2o fields, on a "by model" basis [base_tier_validation_forward](base_tier_validation_forward/) | 3.0.1.0.0| Forward option for base tiers [announcement](announcement/) | 3.0.1.0.0| Notify internal users about relevant organization stuff -[base_tier_validation](base_tier_validation/) | 3.0.2.2.1| Implement a validation process based on tiers. +[base_tier_validation](base_tier_validation/) | 3.0.2.3.0| Implement a validation process based on tiers. [base_revision](base_revision/) | 3.0.1.0.0| Keep track of revised document [date_range_account](date_range_account/) | 3.0.1.0.0| Add Date Range menu entry in Invoicing app [barcode_action](barcode_action/) | 3.0.1.0.0| Allows to use barcodes as a launcher diff --git a/base_tier_validation/README.rst b/base_tier_validation/README.rst index 4906e28..e7a3c53 100644 --- a/base_tier_validation/README.rst +++ b/base_tier_validation/README.rst @@ -7,7 +7,7 @@ Base Tier Validation !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1d286dc389232f0cc60fd6012ae72c5eaf918284c9e7ef73da914cd6691cf822 + !! source digest: sha256:9d45fb0cb0dd64489508d2963bbd948c59b466f16618469b6e86e3d606511aeb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png @@ -66,16 +66,16 @@ To configure this module, you need to: **Note:** -- If check *Notify Reviewers on Creation*, all possible reviewers will - be notified by email when this definition is triggered. -- If check *Notify reviewers on reaching pending* if you want to send a - notification when pending status is reached. This is usefull in a - approve by sequence scenario to only notify reviewers when it is - their turn in the sequence. -- If check *Comment*, reviewers can comment after click Validate or - Reject. -- If check *Approve by sequence*, reviewers is forced to review by - specified sequence. +- If check *Notify Reviewers on Creation*, all possible reviewers will + be notified by email when this definition is triggered. +- If check *Notify reviewers on reaching pending* if you want to send a + notification when pending status is reached. This is usefull in a + approve by sequence scenario to only notify reviewers when it is their + turn in the sequence. +- If check *Comment*, reviewers can comment after click Validate or + Reject. +- If check *Approve by sequence*, reviewers is forced to review by + specified sequence. To configure Tier Validation Exceptions, you need to: @@ -90,16 +90,14 @@ To configure Tier Validation Exceptions, you need to: **Note:** -- If you don't create any exception, the Validated record will be - readonly and cannot be modified. -- If check *Write under Validation*, records will be able to be - modified only in the defined fields when the Validation process is - ongoing. -- If check *Write after Validation*, records will be able to be - modified only in the defined fields when the Validation process is - finished. -- If check *Write after Validation* and *Write under Validation*, - records will be able to be modified defined fields always. +- If you don't create any exception, the Validated record will be + readonly and cannot be modified. +- If check *Write under Validation*, records will be able to be modified + only in the defined fields when the Validation process is ongoing. +- If check *Write after Validation*, records will be able to be modified + only in the defined fields when the Validation process is finished. +- If check *Write after Validation* and *Write under Validation*, + records will be able to be modified defined fields always. Known issues / Roadmap ====================== @@ -107,25 +105,25 @@ Known issues / Roadmap This is the list of known issues for this module. Any proposal for improvement will be very valuable. -- **Issue:** +- **Issue:** - When using approve_sequence option in any tier.definition there can - be inconsistencies in the systray notifications. + When using approve_sequence option in any tier.definition there can be + inconsistencies in the systray notifications. - **Description:** + **Description:** - Field can_review in tier.review is used to filter out, in the systray - notifications, the reviews a user can approve. This can_review field - is updated **in the database** in method review_user_count, this can - make it very inconsistent for databases with a lot of users and - recurring updates that can change the expected behavior. + Field can_review in tier.review is used to filter out, in the systray + notifications, the reviews a user can approve. This can_review field + is updated **in the database** in method review_user_count, this can + make it very inconsistent for databases with a lot of users and + recurring updates that can change the expected behavior. -- **Migration to 15.0:** +- **Migration to 15.0:** - The parameter \_tier_validation_manual_config will become False, on - 14.0, the default value is True, as the change is applied after the - migration. In order to use the new behavior we need to modify the - value on our expected model. + The parameter \_tier_validation_manual_config will become False, on + 14.0, the default value is True, as the change is applied after the + migration. In order to use the new behavior we need to modify the + value on our expected model. Changelog ========= @@ -147,69 +145,69 @@ Migrated to Odoo 14. Fixes: -- When using approve_sequence option in any tier.definition there can - be inconsistencies in the systray notifications -- When using approve_sequence, still not approve only the needed - sequence, but also other sequence for the same approver +- When using approve_sequence option in any tier.definition there can be + inconsistencies in the systray notifications +- When using approve_sequence, still not approve only the needed + sequence, but also other sequence for the same approver 12.0.3.3.1 (2019-12-02) ----------------------- Fixes: -- Show comment on Reviews Table. -- Edit notification with approve_sequence. +- Show comment on Reviews Table. +- Edit notification with approve_sequence. 12.0.3.3.0 (2019-11-27) ----------------------- New features: -- Add comment on Reviews Table. -- Approve by sequence. +- Add comment on Reviews Table. +- Approve by sequence. 12.0.3.2.1 (2019-11-26) ----------------------- Fixes: -- Remove message_subscribe_users +- Remove message_subscribe_users 12.0.3.2.0 (2019-11-25) ----------------------- New features: -- Notify reviewers +- Notify reviewers 12.0.3.1.0 (2019-07-08) ----------------------- Fixes: -- Singleton error +- Singleton error 12.0.3.0.0 (2019-12-02) ----------------------- Fixes: -- Edit Reviews Table +- Edit Reviews Table 12.0.2.1.0 (2019-05-29) ----------------------- Fixes: -- Edit drop-down style width and position +- Edit drop-down style width and position 12.0.2.0.0 (2019-05-28) ----------------------- New features: -- Pass parameters as functions. -- Add Systray. +- Pass parameters as functions. +- Add Systray. 12.0.1.0.0 (2019-02-18) ----------------------- @@ -252,24 +250,24 @@ Authors Contributors ------------ -- Lois Rilo -- Naglis Jonaitis -- Adrià Gil Sorribes -- Pimolnat Suntian -- Pedro Gonzalez -- Kitti U. -- Saran Lim. -- Carlos Lopez -- Javier Colmeiro -- bosd -- Evan Soh -- Manuel Regidor -- Eduardo de Miguel -- `XCG Consulting `__: +- Lois Rilo +- Naglis Jonaitis +- Adrià Gil Sorribes +- Pimolnat Suntian +- Pedro Gonzalez +- Kitti U. +- Saran Lim. +- Carlos Lopez +- Javier Colmeiro +- bosd +- Evan Soh +- Manuel Regidor +- Eduardo de Miguel +- `XCG Consulting `__: - - Houzéfa Abbasbhay + - Houzéfa Abbasbhay -- Stefan Rijnhart +- Stefan Rijnhart Maintainers ----------- diff --git a/base_tier_validation/__manifest__.py b/base_tier_validation/__manifest__.py index f59cd38..278d52e 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": "3.0.2.2.1", + "version": "3.0.2.3.0", "development_status": "Mature", "maintainers": ["LoisRForgeFlow"], "category": "Tools", @@ -14,6 +14,7 @@ "installable": True, "depends": ["mail"], "data": [ + "data/cron_data.xml", "data/mail_data.xml", "security/ir.model.access.csv", "security/tier_validation_security.xml", diff --git a/base_tier_validation/data/cron_data.xml b/base_tier_validation/data/cron_data.xml new file mode 100644 index 0000000..72511c4 --- /dev/null +++ b/base_tier_validation/data/cron_data.xml @@ -0,0 +1,17 @@ + + + + Send Tier Review Reminder + 1 + days + -1 + + + + model._cron_send_review_reminder() + code + + diff --git a/base_tier_validation/data/mail_data.xml b/base_tier_validation/data/mail_data.xml index 42b0ff8..cb99720 100644 --- a/base_tier_validation/data/mail_data.xml +++ b/base_tier_validation/data/mail_data.xml @@ -40,4 +40,22 @@ + + Tier Validation Reminder + + + + + + Tier Validation Reminder + fa-bell + diff --git a/base_tier_validation/i18n/base_tier_validation.pot b/base_tier_validation/i18n/base_tier_validation.pot index bfd6432..f666046 100644 --- a/base_tier_validation/i18n/base_tier_validation.pot +++ b/base_tier_validation/i18n/base_tier_validation.pot @@ -56,6 +56,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "" +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -115,6 +122,11 @@ msgstr "" msgid "All" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -395,6 +407,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -490,6 +507,13 @@ msgstr "" msgid "Notify Reviewers on reaching Pending" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -627,6 +651,16 @@ msgstr "" msgid "Reviews" msgstr "" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -674,7 +708,8 @@ 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. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" @@ -733,6 +768,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" diff --git a/base_tier_validation/i18n/es.po b/base_tier_validation/i18n/es.po index d6e4a5e..a201adb 100644 --- a/base_tier_validation/i18n/es.po +++ b/base_tier_validation/i18n/es.po @@ -71,6 +71,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "Un registro a revisar ha sido creado por %s." +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -130,6 +137,11 @@ msgstr "Actividades" msgid "All" msgstr "Todos" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -426,6 +438,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -521,6 +538,13 @@ msgstr "Notificar a los Revisores al Reiniciar" msgid "Notify Reviewers on reaching Pending" msgstr "Notificar a los Revisores sobre la recepción de Pendientes" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -660,6 +684,16 @@ msgstr "Revisores" msgid "Reviews" msgstr "Revisiones" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -707,11 +741,10 @@ msgstr "Este %s necesita ser validado" #: code:addons/base_tier_validation/models/tier_validation.py:0 #, python-format msgid "" -"This action needs to be validated for at least one record. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Esta acción necesita ser validada para algún registro.\n" -"Por favor, solicita una validación." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -768,6 +801,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "Validación de nivel Notificación rechazada" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -925,6 +964,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "ej. Validación de Nivel por..." +#, python-format +#~ 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." + #, python-format #~ msgid "The operation is under validation." #~ msgstr "Esta operación está en proceso de validación." diff --git a/base_tier_validation/i18n/es_MX.po b/base_tier_validation/i18n/es_MX.po index 89c2c75..cd9eb19 100644 --- a/base_tier_validation/i18n/es_MX.po +++ b/base_tier_validation/i18n/es_MX.po @@ -59,6 +59,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "" +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -119,6 +126,11 @@ msgstr "" msgid "All" msgstr "Todos" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -403,6 +415,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -498,6 +515,13 @@ msgstr "" msgid "Notify Reviewers on reaching Pending" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -635,6 +659,16 @@ msgstr "Revisores" msgid "Reviews" msgstr "Comentarios" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -682,11 +716,10 @@ 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. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Esta acción debe validarse para al menos un registro.\n" -"Solicite una validación." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -743,6 +776,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "Notificación de rechazo de validación de nivel" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -900,6 +939,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "p.ej. Validación de nivel para ..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "Esta acción debe validarse para al menos un registro.\n" +#~ "Solicite una validación." + #, python-format #~ msgid "The operation is under validation." #~ msgstr "La operación está en proceso de validación." diff --git a/base_tier_validation/i18n/fr.po b/base_tier_validation/i18n/fr.po index 2156807..ac8f9d6 100644 --- a/base_tier_validation/i18n/fr.po +++ b/base_tier_validation/i18n/fr.po @@ -59,6 +59,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "" +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -120,6 +127,11 @@ msgstr "Activité" msgid "All" msgstr "Tout" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -404,6 +416,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -499,6 +516,13 @@ msgstr "" msgid "Notify Reviewers on reaching Pending" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -638,6 +662,16 @@ msgstr "Réviseurs" msgid "Reviews" msgstr "Revues" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -685,11 +719,10 @@ msgstr "%s : Cet enregistrement requiert une validation" #: code:addons/base_tier_validation/models/tier_validation.py:0 #, python-format msgid "" -"This action needs to be validated for at least one record. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Cette action requiert une validation pour au moins un des enregistrements. \n" -"Veuillez demander cette validation." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -746,6 +779,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "Validation par niveau - Notification - Rejetée" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -903,6 +942,15 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "par ex Niveau de validation pour..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "Cette action requiert une validation pour au moins un des " +#~ "enregistrements. \n" +#~ "Veuillez demander cette validation." + #, python-format #~ msgid "The operation is under validation." #~ msgstr "Cette opération est en cours de validation." diff --git a/base_tier_validation/i18n/it.po b/base_tier_validation/i18n/it.po index 4827c61..7c58f7b 100644 --- a/base_tier_validation/i18n/it.po +++ b/base_tier_validation/i18n/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-07-29 08:58+0000\n" +"PO-Revision-Date: 2024-11-26 20:06+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -72,6 +72,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "Un record a revisionare è stato creato da %s." +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "Una revisione è stata richiesta %s giorni fa." + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -131,6 +138,11 @@ msgstr "Attività" msgid "All" msgstr "Tutto" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "Permetti scrittura ai revisori" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -429,6 +441,11 @@ msgstr "Completamente validato" msgid "It's in the validation process" msgstr "È nel processo di validazione" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "Data ultimo promemoria" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -524,6 +541,15 @@ msgstr "Notifica revisori al riavvio" msgid "Notify Reviewers on reaching Pending" msgstr "Notifica i revisori quando passa a \"In sospeso\"" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" +"Numero di giorni dopo i quali un messaggio deve essere inviato per ricordare " +"della valutazione in attesa (0 = nessun promemoria)" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -665,6 +691,16 @@ msgstr "Revisori" msgid "Reviews" msgstr "Revisioni" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "Invia promemoria revisione livello" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "Invia messaggio promemoria per le revisioni in attesa" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -712,11 +748,14 @@ msgstr "Questo %s deve essere approvato" #: code:addons/base_tier_validation/models/tier_validation.py:0 #, python-format msgid "" -"This action needs to be validated for at least one record. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Questa azione richiede di essere approvata per almeno un record.\n" -"Prego richiedere un'approvazione." +"Quest'azione deve essere approvata per almeno un record. Approvazioni in " +"sospeso:\n" +" - %s \n" +"Richiedere un'approvazione." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -773,6 +812,12 @@ msgstr "Eccezioni validazione livello" msgid "Tier Validation Rejected Notification" msgstr "Notifica Rifiuto Livello Approvazione" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "Promemoria valutazione livello" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -940,6 +985,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "es. Validazione livello per ..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "Questa azione richiede di essere approvata per almeno un record.\n" +#~ "Prego richiedere un'approvazione." + #~ msgid "Model" #~ msgstr "Modello" diff --git a/base_tier_validation/i18n/nl_NL.po b/base_tier_validation/i18n/nl_NL.po index 897344d..09be3c8 100644 --- a/base_tier_validation/i18n/nl_NL.po +++ b/base_tier_validation/i18n/nl_NL.po @@ -72,6 +72,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "Een record dat dient te worden beoordeeld, is aangemaakt door %s." +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -131,6 +138,11 @@ msgstr "Activiteit" msgid "All" msgstr "Alle" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -417,6 +429,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -512,6 +529,13 @@ msgstr "" msgid "Notify Reviewers on reaching Pending" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -651,6 +675,16 @@ msgstr "Beoordelaars" msgid "Reviews" msgstr "Beoordelingen" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -698,11 +732,10 @@ msgstr "Dit %s dient te worden beoordeeld" #: code:addons/base_tier_validation/models/tier_validation.py:0 #, python-format msgid "" -"This action needs to be validated for at least one record. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Deze actie moet voor ten minste één record gevalideerd worden.\n" -"Vraag een validatie aan." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -759,6 +792,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "Tier-validatie (abstract)" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -916,6 +955,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "bijv. Tier validatie voor..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "Deze actie moet voor ten minste één record gevalideerd worden.\n" +#~ "Vraag een validatie aan." + #, python-format #~ msgid "The operation is under validation." #~ msgstr "De bewerking is onder validatie." diff --git a/base_tier_validation/i18n/sv.po b/base_tier_validation/i18n/sv.po index a58a6a0..a1511fd 100644 --- a/base_tier_validation/i18n/sv.po +++ b/base_tier_validation/i18n/sv.po @@ -71,6 +71,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "En post som ska granskas har skapats av %s." +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -130,6 +137,11 @@ msgstr "Aktivitet" msgid "All" msgstr "Alla" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -427,6 +439,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -522,6 +539,13 @@ msgstr "Meddela granskare vid omstart" msgid "Notify Reviewers on reaching Pending" msgstr "Meddela granskare om att nå Pending" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -661,6 +685,16 @@ msgstr "Granskare" msgid "Reviews" msgstr "Granskningar" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -708,11 +742,10 @@ msgstr "Denna %s måste bekräftas" #: code:addons/base_tier_validation/models/tier_validation.py:0 #, python-format msgid "" -"This action needs to be validated for at least one record. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Denna åtgärd måste bekräftas för minst en post.\n" -"Vänligen begär en validering." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -769,6 +802,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "Meddelande vid nekad attestering" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -926,6 +965,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "t.ex. attestvalidering för..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "Denna åtgärd måste bekräftas för minst en post.\n" +#~ "Vänligen begär en validering." + #, python-format #~ msgid "The operation is under validation." #~ msgstr "Åtgärden håller på att bekräftas." diff --git a/base_tier_validation/i18n/tr.po b/base_tier_validation/i18n/tr.po index 49099ee..9409285 100644 --- a/base_tier_validation/i18n/tr.po +++ b/base_tier_validation/i18n/tr.po @@ -59,6 +59,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "" +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -118,6 +125,11 @@ msgstr "Aktivite" msgid "All" msgstr "Bütün" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -402,6 +414,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -497,6 +514,13 @@ msgstr "" msgid "Notify Reviewers on reaching Pending" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -634,6 +658,16 @@ msgstr "İnceleyenler" msgid "Reviews" msgstr "İncelemeler" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -681,11 +715,10 @@ msgstr "Bu %s 'nin doğrulanması gerekiyor" #: code:addons/base_tier_validation/models/tier_validation.py:0 #, python-format msgid "" -"This action needs to be validated for at least one record. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"Bu eylemin en az bir kayıt için doğrulanması gerekir.\n" -"Lütfen doğrulama isteğinde bulunun." #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -742,6 +775,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "Seviye Doğrulaması Reddedildi Bildirimi" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -899,6 +938,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "ör. Şunun için Seviye Doğrulaması..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "Bu eylemin en az bir kayıt için doğrulanması gerekir.\n" +#~ "Lütfen doğrulama isteğinde bulunun." + #, python-format #~ msgid "The operation is under validation." #~ msgstr "İşlem doğrulama aşamasındadır." diff --git a/base_tier_validation/i18n/zh_CN.po b/base_tier_validation/i18n/zh_CN.po index 43717d9..86cbfb3 100644 --- a/base_tier_validation/i18n/zh_CN.po +++ b/base_tier_validation/i18n/zh_CN.po @@ -59,6 +59,13 @@ msgstr "" msgid "A record to be reviewed has been created by %s." msgstr "" +#. module: base_tier_validation +#. odoo-python +#: code:addons/base_tier_validation/models/tier_review.py:0 +#, python-format +msgid "A review has been requested %s days ago." +msgstr "" + #. module: base_tier_validation #. odoo-python #: code:addons/base_tier_validation/models/tier_validation.py:0 @@ -118,6 +125,11 @@ msgstr "" msgid "All" msgstr "所有" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__allow_write_for_reviewer +msgid "Allow Write For Reviewers" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,help:base_tier_validation.field_tier_validation_exception__group_ids msgid "Allowed groups to use this Tier Validation Exception" @@ -398,6 +410,11 @@ msgstr "" msgid "It's in the validation process" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__last_reminder_date +msgid "Last Reminder Date" +msgstr "" + #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__write_uid #: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__write_uid @@ -493,6 +510,13 @@ msgstr "" msgid "Notify Reviewers on reaching Pending" msgstr "" +#. module: base_tier_validation +#: model:ir.model.fields,help:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "" +"Number of days after which a message must be posted to remind about pending " +"validation (0 = no reminder)" +msgstr "" + #. module: base_tier_validation #: model_terms:ir.actions.act_window,help:base_tier_validation.tier_validation_exception_action msgid "" @@ -630,6 +654,16 @@ msgstr "审批者" msgid "Reviews" msgstr "审批" +#. module: base_tier_validation +#: model:ir.actions.server,name:base_tier_validation.ir_cron_auto_tier_validation_ir_actions_server +msgid "Send Tier Review Reminder" +msgstr "" + +#. module: base_tier_validation +#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__notify_reminder_delay +msgid "Send reminder message on pending reviews" +msgstr "" + #. module: base_tier_validation #. odoo-javascript #: code:addons/base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.xml:0 @@ -677,11 +711,10 @@ 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. \n" +"This action needs to be validated for at least one record. Reviews pending:\n" +" - %s \n" "Please request a validation." msgstr "" -"此操作需要至少对一条记录进行审批。\n" -"请发起审批申请。" #. module: base_tier_validation #: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence @@ -740,6 +773,12 @@ msgstr "" msgid "Tier Validation Rejected Notification" msgstr "多层级审批(抽象)" +#. module: base_tier_validation +#: model:mail.activity.type,name:base_tier_validation.mail_act_tier_validation_reminder +#: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_reminder +msgid "Tier Validation Reminder" +msgstr "" + #. module: base_tier_validation #: model:mail.message.subtype,name:base_tier_validation.mt_tier_validation_requested msgid "Tier Validation Requested" @@ -897,6 +936,14 @@ msgstr "" msgid "e.g. Tier Validation for..." msgstr "例如:审批层级用于..." +#, python-format +#~ msgid "" +#~ "This action needs to be validated for at least one record. \n" +#~ "Please request a validation." +#~ msgstr "" +#~ "此操作需要至少对一条记录进行审批。\n" +#~ "请发起审批申请。" + #, python-format #~ msgid "The operation is under validation." #~ msgstr "该操作正在审批中。" diff --git a/base_tier_validation/models/res_users.py b/base_tier_validation/models/res_users.py index b8e7949..b08a693 100644 --- a/base_tier_validation/models/res_users.py +++ b/base_tier_validation/models/res_users.py @@ -20,11 +20,13 @@ class Users(models.Model): review_groups = self.env["tier.review"].read_group(domain, ["model"], ["model"]) for review_group in review_groups: model = review_group["model"] + Model = self.env[model] reviews = self.env["tier.review"].search(review_group.get("__domain")) - if reviews: + # Skip Models not having Tier Validation enabled (example: was unistalled) + if reviews and hasattr(Model, "can_review"): records = ( - self.env[model] - .with_user(self.env.user) + Model.with_user(self.env.user) + .with_context(active_test=False) .search([("id", "in", reviews.mapped("res_id"))]) .filtered(lambda x: not x.rejected and x.can_review) ) diff --git a/base_tier_validation/models/tier_definition.py b/base_tier_validation/models/tier_definition.py index f8720e0..76f8909 100644 --- a/base_tier_validation/models/tier_definition.py +++ b/base_tier_validation/models/tier_definition.py @@ -38,6 +38,10 @@ class TierDefinition(models.Model): ("field", "Field in related record"), ], ) + allow_write_for_reviewer = fields.Boolean( + string="Allow Write For Reviewers", + default=False, + ) reviewer_id = fields.Many2one(comodel_name="res.users", string="Reviewer") reviewer_group_id = fields.Many2one( comodel_name="res.groups", string="Reviewer group" @@ -90,6 +94,11 @@ class TierDefinition(models.Model): "to this definition are restarted.", ) has_comment = fields.Boolean(string="Comment", default=False) + notify_reminder_delay = fields.Integer( + string="Send reminder message on pending reviews", + help="Number of days after which a message must be posted to remind about " + "pending validation (0 = no reminder)", + ) approve_sequence = fields.Boolean( string="Approve by sequence", default=False, @@ -113,3 +122,33 @@ class TierDefinition(models.Model): .sudo() .search([("model", "=", rec.model), ("relation", "=", "res.users")]) ) + + def _get_review_needing_reminder(self): + """Return all the reviews that have the reminder setup.""" + self.ensure_one() + if not self.notify_reminder_delay: + return self.env["tier.review"] + review_date = fields.Datetime.subtract( + fields.Datetime.now(), days=self.notify_reminder_delay + ) + return self.env["tier.review"].search( + [ + ("definition_id", "=", self.id), + ("status", "in", ["waiting", "pending"]), + "|", + "&", + ("create_date", "<", review_date), + ("last_reminder_date", "=", False), + ("last_reminder_date", "<", review_date), + ], + limit=1, + ) + + def _cron_send_review_reminder(self): + definition_with_reminder = self.env["tier.definition"].search( + [("notify_reminder_delay", ">", 0)] + ) + for record in definition_with_reminder: + review_to_remind = record._get_review_needing_reminder() + if review_to_remind: + review_to_remind._send_review_reminder() diff --git a/base_tier_validation/models/tier_review.py b/base_tier_validation/models/tier_review.py index 908b733..172da55 100644 --- a/base_tier_validation/models/tier_review.py +++ b/base_tier_validation/models/tier_review.py @@ -1,11 +1,15 @@ # Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + import pytz from flectra import _, api, fields, models from flectra.exceptions import ValidationError +_logger = logging.getLogger(__name__) + class TierReview(models.Model): _name = "tier.review" @@ -65,6 +69,7 @@ class TierReview(models.Model): approve_sequence_bypass = fields.Boolean( related="definition_id.approve_sequence_bypass", readonly=True ) + last_reminder_date = fields.Datetime(readonly=True) @api.depends("status") def _compute_display_status(self): @@ -159,3 +164,38 @@ class TierReview(models.Model): """Method to call and reuse abstract notification method""" resource = self.env[self.model].browse(self.res_id) resource._notify_review_available(review_ids) + + def _get_reminder_notification_subtype(self): + return "base_tier_validation.mt_tier_validation_reminder" + + def _get_reminder_activity_type(self): + return "base_tier_validation.mail_act_tier_validation_reminder" + + def _notify_review_reminder_body(self): + delay = (fields.Datetime.now() - self.create_date).days + return _("A review has been requested %s days ago.") % (delay) + + def _send_review_reminder(self): + record = self.env[self.model].browse(self.res_id) + # Only schedule activity if reviewer is a single user and model has activities + if len(self.reviewer_ids) == 1 and hasattr(record, "activity_ids"): + self._schedule_review_reminder_activity(record) + elif hasattr(record, "message_post"): + self._notify_review_reminder(record) + else: + msg = "Could not send reminder for record %s" % record + _logger.exception(msg) + self.last_reminder_date = fields.Datetime.now() + + def _notify_review_reminder(self, record): + record.message_post( + subtype_xmlid=self._get_reminder_notification_subtype(), + body=self._notify_review_reminder_body(), + ) + + def _schedule_review_reminder_activity(self, record): + record.activity_schedule( + act_type_xmlid=self._get_reminder_activity_type(), + note=self._notify_review_reminder_body(), + user_id=self.reviewer_ids.id, + ) diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py index 90d8e64..4d73c06 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -128,19 +128,25 @@ class TierValidation(models.AbstractModel): def _search_validated(self, operator, value): assert operator in ("=", "!="), "Invalid domain operator" assert value in (True, False), "Invalid domain value" - pos = self.search( - [(self._state_field, "in", self._state_from), ("review_ids", "!=", False)] - ).filtered(lambda r: r.validated == value) - return [("id", "in", pos.ids)] + pos = self.search([(self._state_field, "in", self._state_from)]).filtered( + lambda r: r.validated + ) + if value: + return [("id", "in", pos.ids)] + else: + return [("id", "not in", pos.ids)] @api.model def _search_rejected(self, operator, value): assert operator in ("=", "!="), "Invalid domain operator" assert value in (True, False), "Invalid domain value" - pos = self.search( - [(self._state_field, "in", self._state_from), ("review_ids", "!=", False)] - ).filtered(lambda r: r.rejected == value) - return [("id", "in", pos.ids)] + pos = self.search([(self._state_field, "in", self._state_from)]).filtered( + lambda r: r.rejected + ) + if value: + return [("id", "in", pos.ids)] + else: + return [("id", "not in", pos.ids)] @api.model def _search_reviewer_ids(self, operator, value): @@ -304,7 +310,13 @@ class TierValidation(models.AbstractModel): def _check_allow_write_under_validation(self, vals): """Allow to add exceptions for fields that are allowed to be written - even when the record is under validation.""" + or for reviewers for all fields, even when the record is under + validation.""" + if ( + all(self.review_ids.mapped("definition_id.allow_write_for_reviewer")) + and self.env.user in self.reviewer_ids + ): + return True exceptions = self._get_under_validation_exceptions() for val in vals: if val not in exceptions: @@ -341,6 +353,15 @@ class TierValidation(models.AbstractModel): allowed_field_names.append(fld_data["string"]) return allowed_field_names, not_allowed_field_names + 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 vals.get( + self._state_field + ) not in (self._state_to + [self._cancel_state]) + def write(self, vals): self._tier_validation_check_state_on_write(vals) self._tier_validation_check_write_allowed(vals) @@ -382,11 +403,16 @@ class TierValidation(models.AbstractModel): reviews = rec.request_validation() rec._validate_tier(reviews) if not self._calc_reviews_validated(reviews): + pending_reviews = reviews.filtered( + lambda r: r.status == "pending" + ).mapped("name") raise ValidationError( _( "This action needs to be validated for at least " - "one record. \nPlease request a validation." + "one record. Reviews pending:\n - %s " + "\nPlease request a validation." ) + % "\n - ".join(pending_reviews) ) if rec.review_ids and not rec.validated: raise ValidationError( @@ -401,9 +427,7 @@ class TierValidation(models.AbstractModel): # Write under validation if ( rec.review_ids - and getattr(rec, self._state_field) in self._state_from - and vals.get(self._state_field) - not in (self._state_to + [self._cancel_state]) + and rec._check_tier_state_transition(vals) and not rec._check_allow_write_under_validation(vals) and not rec._context.get("skip_validation_check") ): diff --git a/base_tier_validation/security/ir.model.access.csv b/base_tier_validation/security/ir.model.access.csv index 9e4eeb5..d789382 100644 --- a/base_tier_validation/security/ir.model.access.csv +++ b/base_tier_validation/security/ir.model.access.csv @@ -5,7 +5,7 @@ access_tier_review_group_portal,access_tier_review_group_portal,model_tier_revie access_tier_definition_group_portal,access_tier_definition_group_portal,model_tier_definition,base.group_portal,1,0,0,0 access_tier_review,access.tier.review,model_tier_review,base.group_user,1,1,1,1 access_tier_definition_all,tier.definition.all,model_tier_definition,base.group_user,1,0,0,0 -access_tier_definition_settings,tier.definition.settings,model_tier_definition,base.group_system,1,1,1,1 +access_tier_definition_settings,tier.definition.settings,model_tier_definition,base.group_erp_manager,1,1,1,1 access_comment_wizard,access.comment.wizard,model_comment_wizard,base.group_user,1,1,1,1 access_tier_validation_exceptions_all,tier.validation.exceptions,model_tier_validation_exception,,1,0,0,0 access_tier_validation_exceptions_settings,tier.validation.exceptions,model_tier_validation_exception,base.group_system,1,1,1,1 diff --git a/base_tier_validation/static/description/index.html b/base_tier_validation/static/description/index.html index e2c8b72..54037aa 100644 --- a/base_tier_validation/static/description/index.html +++ b/base_tier_validation/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:1d286dc389232f0cc60fd6012ae72c5eaf918284c9e7ef73da914cd6691cf822 +!! source digest: sha256:9d45fb0cb0dd64489508d2963bbd948c59b466f16618469b6e86e3d606511aeb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Mature License: AGPL-3 OCA/server-ux Translate me on Weblate Try me on Runboat

Validating some operations is a common need across different areas in a @@ -433,8 +433,8 @@ functionality. be notified by email when this definition is triggered.

  • If check Notify reviewers on reaching pending if you want to send a notification when pending status is reached. This is usefull in a -approve by sequence scenario to only notify reviewers when it is -their turn in the sequence.
  • +approve by sequence scenario to only notify reviewers when it is their +turn in the sequence.
  • If check Comment, reviewers can comment after click Validate or Reject.
  • If check Approve by sequence, reviewers is forced to review by @@ -455,12 +455,10 @@ both.
    • If you don’t create any exception, the Validated record will be readonly and cannot be modified.
    • -
    • If check Write under Validation, records will be able to be -modified only in the defined fields when the Validation process is -ongoing.
    • -
    • If check Write after Validation, records will be able to be -modified only in the defined fields when the Validation process is -finished.
    • +
    • If check Write under Validation, records will be able to be modified +only in the defined fields when the Validation process is ongoing.
    • +
    • If check Write after Validation, records will be able to be modified +only in the defined fields when the Validation process is finished.
    • If check Write after Validation and Write under Validation, records will be able to be modified defined fields always.
    @@ -471,8 +469,8 @@ records will be able to be modified defined fields always. improvement will be very valuable.

    • Issue:

      -

      When using approve_sequence option in any tier.definition there can -be inconsistencies in the systray notifications.

      +

      When using approve_sequence option in any tier.definition there can be +inconsistencies in the systray notifications.

      Description:

      Field can_review in tier.review is used to filter out, in the systray notifications, the reviews a user can approve. This can_review field @@ -504,8 +502,8 @@ to validate.

      13.0.1.2.2 (2020-08-30)

      Fixes:

        -
      • When using approve_sequence option in any tier.definition there can -be inconsistencies in the systray notifications
      • +
      • When using approve_sequence option in any tier.definition there can be +inconsistencies in the systray notifications
      • When using approve_sequence, still not approve only the needed sequence, but also other sequence for the same approver
      diff --git a/base_tier_validation/tests/__init__.py b/base_tier_validation/tests/__init__.py index c5d19b1..0cbb7c3 100644 --- a/base_tier_validation/tests/__init__.py +++ b/base_tier_validation/tests/__init__.py @@ -2,3 +2,4 @@ from . import common from . import test_tier_validation +from . import test_tier_validation_reminder diff --git a/base_tier_validation/tests/common.py b/base_tier_validation/tests/common.py index 4d030c4..97d6d2d 100644 --- a/base_tier_validation/tests/common.py +++ b/base_tier_validation/tests/common.py @@ -96,7 +96,7 @@ class CommonTierValidation(common.TransactionCase): # Create tier definitions: cls.tier_def_obj = cls.env["tier.definition"] - cls.tier_def_obj.create( + cls.tier_definition = cls.tier_def_obj.create( { "model_id": cls.tester_model.id, "review_type": "individual", diff --git a/base_tier_validation/tests/test_tier_validation.py b/base_tier_validation/tests/test_tier_validation.py index 9d01885..5651ed5 100644 --- a/base_tier_validation/tests/test_tier_validation.py +++ b/base_tier_validation/tests/test_tier_validation.py @@ -999,6 +999,17 @@ class TierTierValidation(CommonTierValidation): self.assertFalse(self.test_record_computed.review_ids) self.test_record_computed.invalidate_recordset() + def test_27_allow_write_for_reviewers(self): + reviews = self.test_record.with_user(self.test_user_2.id).request_validation() + record = self.test_record.with_user(self.test_user_1.id) + record.invalidate_recordset() + with self.assertRaises(ValidationError): + record.with_user(self.test_user_1.id).write({"test_field": 0.3}) + reviews.definition_id.with_user(self.test_user_1.id).write( + {"allow_write_for_reviewer": True} + ) + record.with_user(self.test_user_1.id).write({"test_field": 0.3}) + @tagged("at_install") class TierTierValidationView(CommonTierValidation): diff --git a/base_tier_validation/tests/test_tier_validation_reminder.py b/base_tier_validation/tests/test_tier_validation_reminder.py new file mode 100644 index 0000000..48f98a6 --- /dev/null +++ b/base_tier_validation/tests/test_tier_validation_reminder.py @@ -0,0 +1,46 @@ +# Copyright 2018-19 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from freezegun import freeze_time + +from flectra import fields +from flectra.tests.common import tagged + +from .common import CommonTierValidation + + +@tagged("post_install", "-at_install") +class TierTierValidation(CommonTierValidation): + def test_validation_reminder(self): + """Check the posting of reminder to reviews.""" + tier_definition = self.tier_definition + tier_definition.notify_reminder_delay = 3 + + # Request a review today + self.test_record.with_user(self.test_user_2.id).request_validation() + review = self.env["tier.review"].search( + [("definition_id", "=", tier_definition.id)] + ) + self.assertTrue(review) + self.assertEqual(review.last_reminder_date, False) + + # 2 days later no reminder should be posted + in_2_days = fields.Datetime.add(fields.Datetime.now(), days=2) + with freeze_time(in_2_days): + tier_definition._cron_send_review_reminder() + self.assertEqual(review.last_reminder_date, False) + # 4 days later first reminder + in_4_days = fields.Datetime.add(fields.Datetime.now(), days=4) + with freeze_time(in_4_days): + self.tier_definition._cron_send_review_reminder() + self.assertEqual(review.last_reminder_date, in_4_days) + # 5 days later no new reminder + in_6_days = fields.Datetime.add(fields.Datetime.now(), days=6) + with freeze_time(in_6_days): + self.tier_definition._cron_send_review_reminder() + self.assertEqual(review.last_reminder_date, in_4_days) + # 9 days later second reminder + in_9_days = fields.Datetime.add(fields.Datetime.now(), days=9) + with freeze_time(in_9_days): + self.tier_definition._cron_send_review_reminder() + self.assertEqual(review.last_reminder_date, in_9_days) diff --git a/base_tier_validation/views/tier_definition_view.xml b/base_tier_validation/views/tier_definition_view.xml index 0a5a1c0..1b9362f 100644 --- a/base_tier_validation/views/tier_definition_view.xml +++ b/base_tier_validation/views/tier_definition_view.xml @@ -55,6 +55,7 @@ + +