Skip to content

Commit

Permalink
product_expiry_simple: use format_date to show date in lot display_name
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Sep 4, 2022
1 parent 07ca679 commit ca5daca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions product_expiry_simple/models/stock_production_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo.tools.misc import format_date


class StockProductionLot(models.Model):
Expand All @@ -27,9 +28,10 @@ def name_get(self):
for lot in self:
dname = lot.name
if lot.expiry_date:
expiry_date_print = format_date(self.env, lot.expiry_date)
if lot.expiry_date < today:
dname = _("[%s Expired] %s") % (lot.expiry_date, dname)
dname = _("[%s Expired] %s") % (expiry_date_print, dname)
else:
dname = "[%s] %s" % (lot.expiry_date, dname)
dname = "[%s] %s" % (expiry_date_print, dname)
res.append((lot.id, dname))
return res

0 comments on commit ca5daca

Please sign in to comment.