From 88bf281d7f398b5dceb624a79f178387022fc3e7 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Wed, 15 May 2019 13:33:14 +0200 Subject: [PATCH 1/2] [11.0][FIX] base_tier_validation: make name translatable and display reviews' name and state correctly translated. --- base_tier_validation/__manifest__.py | 2 +- base_tier_validation/models/res_users.py | 11 +++++++++-- base_tier_validation/models/tier_definition.py | 10 +++++++--- .../static/src/xml/tier_review_template.xml | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/base_tier_validation/__manifest__.py b/base_tier_validation/__manifest__.py index ff67920..4fdbde9 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": "11.0.2.0.1", + "version": "11.0.2.1.0", "development_status": "Mature", "maintainers": ['lreficent'], "category": "Tools", diff --git a/base_tier_validation/models/res_users.py b/base_tier_validation/models/res_users.py index 930845d..b32d016 100644 --- a/base_tier_validation/models/res_users.py +++ b/base_tier_validation/models/res_users.py @@ -34,5 +34,12 @@ class Users(models.Model): @api.model def get_reviews(self, data): - return self.env['tier.review'].search_read( - [('id', 'in', data.get('res_ids'))]) + review_obj = self.env['tier.review'].with_context( + lang=self.env.user.lang) + res = review_obj.search_read([('id', 'in', data.get('res_ids'))]) + for r in res: + # Get the translated status value. + r['display_status'] = dict( + review_obj.fields_get('status')['status']['selection'] + ).get(r.get('status')) + return res diff --git a/base_tier_validation/models/tier_definition.py b/base_tier_validation/models/tier_definition.py index 95e0b1d..84aa4c5 100644 --- a/base_tier_validation/models/tier_definition.py +++ b/base_tier_validation/models/tier_definition.py @@ -1,7 +1,7 @@ # Copyright 2017 Eficent Business and IT Consulting Services S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import api, fields, models, _ class TierDefinition(models.Model): @@ -10,7 +10,7 @@ class TierDefinition(models.Model): @api.model def _get_default_name(self): - return "New Tier Validation" + return _("New Tier Validation") @api.model def _get_tier_validation_model_names(self): @@ -18,7 +18,11 @@ class TierDefinition(models.Model): return res name = fields.Char( - 'Description', required=True, default=_get_default_name) + string='Description', + required=True, + default=_get_default_name, + translate=True, + ) model_id = fields.Many2one( comodel_name="ir.model", string="Referenced Model", diff --git a/base_tier_validation/static/src/xml/tier_review_template.xml b/base_tier_validation/static/src/xml/tier_review_template.xml index 0154a8e..d8821b8 100644 --- a/base_tier_validation/static/src/xml/tier_review_template.xml +++ b/base_tier_validation/static/src/xml/tier_review_template.xml @@ -44,7 +44,7 @@ - + From bde1ff004079de95674518461cf2a284b54bbc05 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Wed, 15 May 2019 13:35:14 +0200 Subject: [PATCH 2/2] [11.0][UPD] base_tier_validation: roadmap. * using similar approach to activities has already benn addressed. * add a new point explaining review tooltip improvement possibilities. --- base_tier_validation/README.rst | 5 ++++- base_tier_validation/readme/ROADMAP.rst | 5 ++++- base_tier_validation/static/description/index.html | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/base_tier_validation/README.rst b/base_tier_validation/README.rst index 4cdcd67..27881c3 100644 --- a/base_tier_validation/README.rst +++ b/base_tier_validation/README.rst @@ -52,7 +52,10 @@ To configure this module, you need to: Known issues / Roadmap ====================== -* In odoo v11 it would be interesting to try to take advantage of ``mail.activity.mixin``. +* It would be interesting to improve the current tooltip to display reviews + to make it responsible and more "Odoo-ish". For instance, to use a + widget capable to display a tree view as a drop-down without needing + to navigate to a new screen. Bug Tracker =========== diff --git a/base_tier_validation/readme/ROADMAP.rst b/base_tier_validation/readme/ROADMAP.rst index 54bada4..53280de 100644 --- a/base_tier_validation/readme/ROADMAP.rst +++ b/base_tier_validation/readme/ROADMAP.rst @@ -1 +1,4 @@ -* In odoo v11 it would be interesting to try to take advantage of ``mail.activity.mixin``. +* It would be interesting to improve the current tooltip to display reviews + to make it responsible and more "Odoo-ish". For instance, to use a + widget capable to display a tree view as a drop-down without needing + to navigate to a new screen. diff --git a/base_tier_validation/static/description/index.html b/base_tier_validation/static/description/index.html index 73ef5c3..d32f7e2 100644 --- a/base_tier_validation/static/description/index.html +++ b/base_tier_validation/static/description/index.html @@ -400,7 +400,10 @@ functionality.

Known issues / Roadmap

    -
  • In odoo v11 it would be interesting to try to take advantage of mail.activity.mixin.
  • +
  • It would be interesting to improve the current tooltip to display reviews +to make it responsible and more “Odoo-ish”. For instance, to use a +widget capable to display a tree view as a drop-down without needing +to navigate to a new screen.