Skip to content

Commit

Permalink
[IMP] product_expiry_simple: backport small usability improvements
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexis-via committed Dec 19, 2024
1 parent 841e1a9 commit 93d645f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions product_expiry_simple/models/stock_production_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# 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):
Expand All @@ -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}"

Check warning on line 33 in product_expiry_simple/models/stock_production_lot.py

View check run for this annotation

Codecov / codecov/patch

product_expiry_simple/models/stock_production_lot.py#L33

Added line #L33 was not covered by tests
else:
dname = "[%s] %s" % (expiry_date_print, dname)
res.append((lot.id, dname))
Expand Down

0 comments on commit 93d645f

Please sign in to comment.