Add "time ago" for "product already receieved" alert on mobile
This commit is contained in:
parent
f755aefbfa
commit
7fab472fc4
|
@ -30,13 +30,14 @@ import re
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
import humanize
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from rattail import pod
|
from rattail import pod
|
||||||
from rattail.db import model, api, Session as RattailSession
|
from rattail.db import model, api, Session as RattailSession
|
||||||
from rattail.db.util import maxlen
|
from rattail.db.util import maxlen
|
||||||
from rattail.gpc import GPC
|
from rattail.gpc import GPC
|
||||||
from rattail.time import localtime
|
from rattail.time import localtime, make_utc
|
||||||
from rattail.util import pretty_quantity, prettify, OrderedDict
|
from rattail.util import pretty_quantity, prettify, OrderedDict
|
||||||
from rattail.vendors.invoices import iter_invoice_parsers, require_invoice_parser
|
from rattail.vendors.invoices import iter_invoice_parsers, require_invoice_parser
|
||||||
from rattail.threads import Thread
|
from rattail.threads import Thread
|
||||||
|
@ -1561,7 +1562,9 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
default=False)
|
default=False)
|
||||||
if alert_received:
|
if alert_received:
|
||||||
if self.handler.get_units_confirmed(row):
|
if self.handler.get_units_confirmed(row):
|
||||||
self.request.session.flash("You have already received some of this product.", 'receiving-warning')
|
msg = "You have already received some of this product; last update was {}.".format(
|
||||||
|
humanize.naturaltime(make_utc() - row.modified))
|
||||||
|
self.request.session.flash(msg, 'receiving-warning')
|
||||||
|
|
||||||
return self.render_to_response('receive_row', context, mobile=True)
|
return self.render_to_response('receive_row', context, mobile=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue