Browse Source

[11.0][FIX] base_tier_validation: make name translatable and display reviews' name and state correctly translated.

pull/69/head
Lois Rilo 6 years ago
parent
commit
78a48b92ca
  1. 4
      base_tier_validation/__manifest__.py
  2. 11
      base_tier_validation/models/res_users.py
  3. 10
      base_tier_validation/models/tier_definition.py
  4. 2
      base_tier_validation/static/src/xml/tier_review_template.xml

4
base_tier_validation/__manifest__.py

@ -1,9 +1,9 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017-19 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Base Tier Validation",
"summary": "Implement a validation process based on tiers.",
"version": "12.0.2.0.1",
"version": "12.0.2.1.0",
"development_status": "Mature",
"maintainers": ['lreficent'],
"category": "Tools",

11
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

10
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",

2
base_tier_validation/static/src/xml/tier_review_template.xml

@ -44,7 +44,7 @@
<span t-esc="review.name"/>
</td>
<td class="text-right">
<span t-esc="review.status"/>
<span t-esc="review.display_status"/>
</td>
<td class="text-right">
<span t-esc="review.done_by[1]"/>

Loading…
Cancel
Save