From 4caa0af4429731dc41c9e09613c945ea9d933f4b Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Tue, 15 Jan 2019 13:02:58 +0100 Subject: [PATCH] [11.0][IMP] base_tier_validation: enhance views and register who does and who asks for reviews in new fields 'done_by' and 'requested_by'. --- base_tier_validation/README.rst | 74 ++- base_tier_validation/__manifest__.py | 4 +- base_tier_validation/models/tier_review.py | 6 + .../models/tier_validation.py | 11 +- base_tier_validation/readme/CONFIGURE.rst | 5 + base_tier_validation/readme/CONTRIBUTORS.rst | 1 + base_tier_validation/readme/DESCRIPTION.rst | 9 + base_tier_validation/readme/ROADMAP.rst | 1 + .../static/description/index.html | 443 ++++++++++++++++++ .../views/tier_definition_view.xml | 60 ++- .../views/tier_review_view.xml | 2 + 11 files changed, 575 insertions(+), 41 deletions(-) create mode 100644 base_tier_validation/readme/CONFIGURE.rst create mode 100644 base_tier_validation/readme/CONTRIBUTORS.rst create mode 100644 base_tier_validation/readme/DESCRIPTION.rst create mode 100644 base_tier_validation/readme/ROADMAP.rst create mode 100644 base_tier_validation/static/description/index.html diff --git a/base_tier_validation/README.rst b/base_tier_validation/README.rst index 977eb44..6d5a4ff 100644 --- a/base_tier_validation/README.rst +++ b/base_tier_validation/README.rst @@ -1,11 +1,30 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - ==================== Base Tier Validation ==================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png + :target: https://odoo-community.org/page/development-status + :alt: Mature +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github + :target: https://github.com/OCA/server-ux/tree/11.0/base_tier_validation + :alt: OCA/server-ux +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-ux-11-0/server-ux-11-0-base_tier_validation + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/250/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module does not provide a functionality by itself but an abstract model to implement a validation process based on tiers on other models (e.g. purchase orders, sales orders...). @@ -16,6 +35,11 @@ development. See `purchase_tier_validation `_ as an example of implementation. +**Table of contents** + +.. contents:: + :local: + Configuration ============= @@ -25,10 +49,6 @@ To configure this module, you need to: #. Create as many tiers as you want for any model having tier validation functionality. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/250/11.0 - Known issues / Roadmap ====================== @@ -37,37 +57,47 @@ Known issues / Roadmap Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smash it by providing detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Eficent Contributors ------------- +~~~~~~~~~~~~ * Lois Rilo -Do not contact contributors directly about support or help with technical issues. +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +.. |maintainer-lreficent| image:: https://github.com/lreficent.png?size=40px + :target: https://github.com/lreficent + :alt: lreficent + +Current `maintainer `__: + +|maintainer-lreficent| + +This module is part of the `OCA/server-ux `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_tier_validation/__manifest__.py b/base_tier_validation/__manifest__.py index febb73f..667ae85 100644 --- a/base_tier_validation/__manifest__.py +++ b/base_tier_validation/__manifest__.py @@ -3,7 +3,9 @@ { "name": "Base Tier Validation", "summary": "Implement a validation process based on tiers.", - "version": "11.0.1.0.0", + "version": "11.0.1.1.0", + "development_status": "Mature", + "maintainers": ['lreficent'], "category": "Tools", "website": "https://github.com/OCA/server-ux", "author": "Eficent, Odoo Community Association (OCA)", diff --git a/base_tier_validation/models/tier_review.py b/base_tier_validation/models/tier_review.py index c5f46dc..5e1c9c2 100644 --- a/base_tier_validation/models/tier_review.py +++ b/base_tier_validation/models/tier_review.py @@ -32,6 +32,12 @@ class TierReview(models.Model): compute="_compute_reviewer_ids", store=True, ) sequence = fields.Integer(string="Tier") + done_by = fields.Many2one( + comodel_name="res.users", + ) + requested_by = fields.Many2one( + comodel_name="res.users", + ) @api.multi @api.depends('reviewer_id', 'reviewer_group_id', 'reviewer_group_id.users') diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py index 66473a1..10ff646 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -148,7 +148,10 @@ class TierValidation(models.AbstractModel): lambda r: r.status in ('pending', 'rejected') and (r.reviewer_id == self.env.user or r.reviewer_group_id in self.env.user.groups_id)) - user_reviews.write({'status': 'approved'}) + user_reviews.write({ + 'status': 'approved', + 'done_by': self.env.user.id, + }) @api.multi def validate_tier(self): @@ -162,7 +165,10 @@ class TierValidation(models.AbstractModel): lambda r: r.status in ('pending', 'approved') and (r.reviewer_id == self.env.user or r.reviewer_group_id in self.env.user.groups_id)) - user_reviews.write({'status': 'rejected'}) + user_reviews.write({ + 'status': 'rejected', + 'done_by': self.env.user.id, + }) @api.multi def request_validation(self): @@ -182,6 +188,7 @@ class TierValidation(models.AbstractModel): 'res_id': rec.id, 'definition_id': td.id, 'sequence': sequence, + 'requested_by': self.env.uid, }) # TODO: notify? post some msg in chatter? return created_trs diff --git a/base_tier_validation/readme/CONFIGURE.rst b/base_tier_validation/readme/CONFIGURE.rst new file mode 100644 index 0000000..11fb42e --- /dev/null +++ b/base_tier_validation/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +To configure this module, you need to: + +#. Go to *Settings > Technical > Tier Validations > Tier Definition*. +#. Create as many tiers as you want for any model having tier validation + functionality. diff --git a/base_tier_validation/readme/CONTRIBUTORS.rst b/base_tier_validation/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..4b57463 --- /dev/null +++ b/base_tier_validation/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Lois Rilo diff --git a/base_tier_validation/readme/DESCRIPTION.rst b/base_tier_validation/readme/DESCRIPTION.rst new file mode 100644 index 0000000..d314eab --- /dev/null +++ b/base_tier_validation/readme/DESCRIPTION.rst @@ -0,0 +1,9 @@ +This module does not provide a functionality by itself but an abstract model +to implement a validation process based on tiers on other models (e.g. +purchase orders, sales orders...). + +**Note:** To be able to use this module in a new model you will need some +development. + +See `purchase_tier_validation `_ as an example of implementation. diff --git a/base_tier_validation/readme/ROADMAP.rst b/base_tier_validation/readme/ROADMAP.rst new file mode 100644 index 0000000..54bada4 --- /dev/null +++ b/base_tier_validation/readme/ROADMAP.rst @@ -0,0 +1 @@ +* In odoo v11 it would be interesting to try to take advantage of ``mail.activity.mixin``. diff --git a/base_tier_validation/static/description/index.html b/base_tier_validation/static/description/index.html new file mode 100644 index 0000000..ff0ae9b --- /dev/null +++ b/base_tier_validation/static/description/index.html @@ -0,0 +1,443 @@ + + + + + + +Base Tier Validation + + + +
+

Base Tier Validation

+ + +

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

+

This module does not provide a functionality by itself but an abstract model +to implement a validation process based on tiers on other models (e.g. +purchase orders, sales orders…).

+

Note: To be able to use this module in a new model you will need some +development.

+

See purchase_tier_validation as an example of implementation.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Settings > Technical > Tier Validations > Tier Definition.
  2. +
  3. Create as many tiers as you want for any model having tier validation +functionality.
  4. +
+
+
+

Known issues / Roadmap

+
    +
  • In odoo v11 it would be interesting to try to take advantage of mail.activity.mixin.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Eficent
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

lreficent

+

This module is part of the OCA/server-ux project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_tier_validation/views/tier_definition_view.xml b/base_tier_validation/views/tier_definition_view.xml index 5aadc35..dafa6fc 100644 --- a/base_tier_validation/views/tier_definition_view.xml +++ b/base_tier_validation/views/tier_definition_view.xml @@ -9,6 +9,9 @@ + + + @@ -21,34 +24,59 @@ tier.definition
- - - - - - + +
+ +
+ + + + + + + + + + + - - - - + + - - - - +
+ + tier.definition.search + tier.definition + + + + + + + + + + + + + + + Tier Definition ir.actions.act_window tier.definition form tree,form + {'search_default_all': 1} + +