Skip to content

Commit 1ae4499

Browse files
[IMP] shopfloor_reception_mobile: add red color for past lot expiration date
1 parent 0f9a0ee commit 1ae4499

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

shopfloor_reception_mobile/static/src/scenario/reception.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,23 @@ const Reception = {
298298
},
299299
};
300300
},
301+
_get_lot_expiration_date_klass: function () {
302+
let klass = "loud";
303+
const expiryValue = _.result(
304+
this.line_being_handled,
305+
"lot.expiration_date"
306+
);
307+
308+
if (expiryValue) {
309+
const expiryDate = new Date(expiryValue);
310+
const now = new Date();
311+
if (expiryDate < now) {
312+
klass += " red";
313+
}
314+
}
315+
return klass;
316+
},
317+
301318
picking_detail_options_for_set_lot: function () {
302319
return {
303320
key_title: "product.display_name",
@@ -321,7 +338,7 @@ const Reception = {
321338
{
322339
path: "lot.expiration_date",
323340
label: "Expiry date",
324-
klass: "loud",
341+
klass: this._get_lot_expiration_date_klass(),
325342
renderer: (rec, field) => {
326343
return this.utils.display.format_date_display(
327344
_.result(rec, field.path),

0 commit comments

Comments
 (0)