Skip to content

Commit

Permalink
[REF] flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
reinka committed Jun 24, 2017
1 parent f2d6317 commit 4ba0167
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion website_sale_recently_viewed_products/controllers/main.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-

from odoo import fields, http
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.http import request


class WebsiteSale(WebsiteSale):

@http.route()
def product(self, product, category='', search='', **kwargs):
"""Add / update recently viewed products."""
record = request.env['website.sale.product.view'].search([
('sessionid', '=', request.session.sid),
('product_id', '=', product.id)
Expand All @@ -25,6 +26,7 @@ def product(self, product, category='', search='', **kwargs):

@http.route(['/shop/recent'], type='http', auth='public', website=True)
def recent(self, **kwargs):
"""Render recently viewed products."""
records = request.env['website.sale.product.view'].search(
[('sessionid', '=', request.session.sid)], limit=10)
values = {'history': records}
Expand Down
5 changes: 3 additions & 2 deletions website_sale_recently_viewed_products/models/product_view.py
@@ -1,4 +1,4 @@
from odoo import api, fields, models, _
from odoo import _, api, fields, models


class ProductHistory(models.Model):
Expand All @@ -18,7 +18,8 @@ class ProductHistory(models.Model):

@api.multi
def human_readable_datetime_difference(self, now=None):
"""
"""Return time passed since last time viewed.
Return an human readable form of the difference between the supplied
datetime (or the current datetime if not supplied) and the history
record ``last_view_datetime``.
Expand Down
1 change: 1 addition & 0 deletions website_sale_recently_viewed_products/models/website.py
Expand Up @@ -7,5 +7,6 @@ class Website(models.Model):

@api.multi
def recently_viewed_products(self):
"""Return recently viewed products."""
return request.env['website.sale.product.view'].search([
('sessionid', '=', request.session.sid)], limit=10)
2 changes: 1 addition & 1 deletion website_sale_recently_viewed_products/tests/test_ui.py
Expand Up @@ -13,4 +13,4 @@ def test_ui_website(self):
code="odoo.__DEBUG__.services['web_tour.tour']"
".run('test_website_sale_recently_viewed_products', 'test')",
ready="odoo.__DEBUG__.services['web_tour.tour']"
".tours.test_website_sale_recently_viewed_products.ready")
".tours.test_website_sale_recently_viewed_products.ready")

0 comments on commit 4ba0167

Please sign in to comment.