diff options
| author | Tonow-c2c <thomas.nowicki@camptocamp.com> | 2019-12-04 12:35:54 +0000 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2020-04-14 08:44:38 +0000 |
| commit | 2038ff2f26b1454ae0c8a44c8a03ece0ee945998 (patch) | |
| tree | c9ea2771aeda4c3d5ead3ce40316a77ab616c10e /addons | |
| parent | de322086eb55331f9d5bcac441ea7b4440ced5df (diff) | |
[FIX] sale: change the date to isoformat to be serializable
Avoid posting message if we are still on the same date
closes odoo/odoo#49486
X-original-commit: 5bd98159878501a8d1d3af336c1f895ed342268e
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Co-authored-by: Damien Bouvy <dbo@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/sale/controllers/portal.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index e951dce54b2..1c7ce875081 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -153,13 +153,15 @@ class CustomerPortal(CustomerPortal): # use sudo to allow accessing/viewing orders for public user # only if he knows the private token - now = fields.Date.today() - # Log only once a day - if order_sudo and request.session.get('view_quote_%s' % order_sudo.id) != now and request.env.user.share and access_token: - request.session['view_quote_%s' % order_sudo.id] = now - body = _('Quotation viewed by customer %s') % order_sudo.partner_id.name - _message_post_helper('sale.order', order_sudo.id, body, token=order_sudo.access_token, message_type='notification', subtype_xmlid="mail.mt_note") + if order_sudo: + # store the date as a string in the session to allow serialization + now = fields.Date.today().isoformat() + session_obj_date = request.session.get('view_quote_%s' % order_sudo.id) + if session_obj_date != now and request.env.user.share and access_token: + request.session['view_quote_%s' % order_sudo.id] = now + body = _('Quotation viewed by customer %s') % order_sudo.partner_id.name + _message_post_helper('sale.order', order_sudo.id, body, token=order_sudo.access_token, message_type='notification', subtype_xmlid="mail.mt_note") values = { 'sale_order': order_sudo, |
