diff options
| author | nje-odoo <nje@odoo.com> | 2019-12-02 11:15:34 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-12-31 12:17:26 +0000 |
| commit | 92472fbf9cabcc7c8a7bb5703bd5ac85ccd3a55e (patch) | |
| tree | cfaa24fefb0f81cf5b3597fab03b629fb0eea60f /addons/lunch | |
| parent | 5b62f6e0b629eaa42d86edebe23b426d4cbdd46b (diff) | |
[IMP] lunch : make field translatable.
Now we can translate name and description field in lunch.product object
and we want that translation in kanban view of 'lunch.product.report'.
So we set related field in 'lunch.product.report' and remove those fields
from init().
Due to related field it will affect on performace of lunch.product.report
kanban view loading.
Task-2068989
closes odoo/odoo#41206
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/lunch')
| -rw-r--r-- | addons/lunch/models/lunch_alert.py | 4 | ||||
| -rw-r--r-- | addons/lunch/models/lunch_product.py | 6 | ||||
| -rw-r--r-- | addons/lunch/report/lunch_product_report.py | 6 |
3 files changed, 7 insertions, 9 deletions
diff --git a/addons/lunch/models/lunch_alert.py b/addons/lunch/models/lunch_alert.py index 45795f1e662..9110f792356 100644 --- a/addons/lunch/models/lunch_alert.py +++ b/addons/lunch/models/lunch_alert.py @@ -19,8 +19,8 @@ class LunchAlert(models.Model): _description = 'Lunch Alert' _order = 'write_date desc, id' - name = fields.Char('Alert Name', required=True) - message = fields.Html('Message', required=True) + name = fields.Char('Alert Name', required=True, translate=True) + message = fields.Html('Message', required=True, translate=True) mode = fields.Selection([ ('alert', 'Alert in app'), diff --git a/addons/lunch/models/lunch_product.py b/addons/lunch/models/lunch_product.py index 4569710a129..bf0009b3057 100644 --- a/addons/lunch/models/lunch_product.py +++ b/addons/lunch/models/lunch_product.py @@ -12,7 +12,7 @@ class LunchProductCategory(models.Model): _inherit = 'image.mixin' _description = 'Lunch Product Category' - name = fields.Char('Product Category', required=True) + name = fields.Char('Product Category', required=True, translate=True) company_id = fields.Many2one('res.company', default=lambda self: self.env.company) currency_id = fields.Many2one('res.currency', related='company_id.currency_id') topping_label_1 = fields.Char('Extra 1 Label', required=True, default='Extras') @@ -89,9 +89,9 @@ class LunchProduct(models.Model): _inherit = 'image.mixin' _order = 'name' - name = fields.Char('Product Name', required=True) + name = fields.Char('Product Name', required=True, translate=True) category_id = fields.Many2one('lunch.product.category', 'Product Category', required=True) - description = fields.Text('Description') + description = fields.Text('Description', translate=True) price = fields.Float('Price', digits='Account', required=True) supplier_id = fields.Many2one('lunch.supplier', 'Vendor', required=True) active = fields.Boolean(default=True) diff --git a/addons/lunch/report/lunch_product_report.py b/addons/lunch/report/lunch_product_report.py index f61c2724fb3..bd2f93600c5 100644 --- a/addons/lunch/report/lunch_product_report.py +++ b/addons/lunch/report/lunch_product_report.py @@ -13,9 +13,9 @@ class LunchProductReport(models.Model): id = fields.Integer('ID') product_id = fields.Many2one('lunch.product', 'Product') - name = fields.Char('Product Name') + name = fields.Char('Product Name', related='product_id.name') category_id = fields.Many2one('lunch.product.category', 'Product Category') - description = fields.Text('Description') + description = fields.Text('Description', related='product_id.description') price = fields.Float('Price') supplier_id = fields.Many2one('lunch.supplier', 'Vendor') company_id = fields.Many2one('res.company') @@ -81,9 +81,7 @@ class LunchProductReport(models.Model): SELECT row_number() over (ORDER BY users.id,product.id) AS id, product.id AS product_id, - product.name, product.category_id, - product.description, product.price, product.supplier_id, product.company_id, |
