From 93d645fc80a56a21633dfb64e00df67ed73078e5 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 19 Dec 2024 15:11:56 +0100 Subject: [PATCH] [IMP] product_expiry_simple: backport small usability improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Track expiry_date on stock.lot Replace 'Expired' string in display_name by unicode warning sign (⚠) to avoid translation difficulties in report and win horizontal space --- product_expiry_simple/models/stock_production_lot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/product_expiry_simple/models/stock_production_lot.py b/product_expiry_simple/models/stock_production_lot.py index 70666c209d11..6cc18324d141 100644 --- a/product_expiry_simple/models/stock_production_lot.py +++ b/product_expiry_simple/models/stock_production_lot.py @@ -3,14 +3,14 @@ # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.tools.misc import format_date class StockProductionLot(models.Model): _inherit = "stock.production.lot" - expiry_date = fields.Date(string="Expiry Date") + expiry_date = fields.Date(string="Expiry Date", tracking=True) expired = fields.Boolean(compute="_compute_expired") def _compute_expired(self): @@ -30,7 +30,7 @@ def name_get(self): if lot.expiry_date: expiry_date_print = format_date(self.env, lot.expiry_date) if lot.expiry_date < today: - dname = _("[%s Expired] %s") % (expiry_date_print, dname) + dname = f"[{expiry_date_print} ⚠] {dname}" else: dname = "[%s] %s" % (expiry_date_print, dname) res.append((lot.id, dname))