diff --git a/addons/website_quotation/controllers/main.py b/addons/website_quotation/controllers/main.py index a824822c568..27575870ca8 100644 --- a/addons/website_quotation/controllers/main.py +++ b/addons/website_quotation/controllers/main.py @@ -38,9 +38,12 @@ class sale_quote(http.Controller): # use SUPERUSER_ID allow to access/view order for public user # only if he knows the private token order = request.registry.get('sale.order').browse(request.cr, token and SUPERUSER_ID or request.uid, order_id) + now = time.strftime('%Y-%m-%d') if token: assert token == order.access_token, 'Access denied!' - if not message: + # Log only once a day + if request.httprequest.session.get('view_quote',False)!=now: + request.httprequest.session['view_quote'] = now body=_('Quotation viewed by customer') self.__message_post(body, order_id, type='comment') days = 0 @@ -50,7 +53,7 @@ class sale_quote(http.Controller): 'quotation': order, 'message': message and int(message) or False, 'option': bool(filter(lambda x: not x.line_id, order.options)), - 'order_valid': (not order.validity_date) or (datetime.datetime.now().strftime('%Y-%m-%d') <= order.validity_date), + 'order_valid': (not order.validity_date) or (now <= order.validity_date), 'days_valid': max(days, 0) } return request.website.render('website_quotation.so_quotation', values) diff --git a/addons/website_quotation/views/website_quotation.xml b/addons/website_quotation/views/website_quotation.xml index 5a703ad96c0..1a2c2a8c05c 100644 --- a/addons/website_quotation/views/website_quotation.xml +++ b/addons/website_quotation/views/website_quotation.xml @@ -113,17 +113,19 @@ @@ -219,7 +221,6 @@
-

Message

Your message has been successfully sent!