Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD][website_sale_wishlist] Wishlist for your online shop. #122

Merged
merged 8 commits into from
Oct 18, 2016

Conversation

yajo
Copy link
Member

@yajo yajo commented Aug 26, 2016

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

@Tecnativa

@rafaelbn rafaelbn added this to the 9.0 milestone Aug 30, 2016
@rafaelbn
Copy link
Member

Tested in runbot 👍

@rafaelbn
Copy link
Member

@yajo could you increase coverage?

cc @pedrobaeza @sergio-teruel @carlosdauden

@sergio-teruel
Copy link
Contributor

Tested in runbot 👍

"category": "Website",
"website": "https://tecnativa.com/",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "LGPL-3",
Copy link
Member

@atchuthan atchuthan Aug 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For OCA modules, the license is generally AGPL-3.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OCA admits any OSI approved license (including this). We have chosen this license for website related modules for allowing to put specific stuff on top of these modules and for not being forced to give the source code of this to any of the visitors of the website.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@atchuthan
Copy link
Member

Tested in runbot 👍

(Wishlist/Suggestion)
When we add a product using "add cart" from wishlist window, we could probably remove the wishlist of the added product.

@rafaelbn
Copy link
Member

Hi @atchuthan ,

"When we add a product using "add cart" from wishlist window, we could probably remove the wishlist of the added product."

That is what cart do, wishlist must be persistent as it could be used for you favourites products

@yajo
Copy link
Member Author

yajo commented Aug 31, 2016

Thanks @atchuthan, I thought on that, but it seems to me that maybe users want to use it as a "bookmark", or they could want to buy again those same products later, so I prefer this module not to be so smart. Removing them is just one click away.

@sergio-teruel
Copy link
Contributor

I think the same that Yajo

@@ -0,0 +1,9 @@
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
- !record {id: garbage_collector, model: ir.cron}:
Copy link
Member

@pedrobaeza pedrobaeza Sep 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember me why do we need this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for removing wishlist items for non-users and sessions that no longer exist

@antespi
Copy link

antespi commented Sep 9, 2016

👍 tested in runbot

@rafaelbn
Copy link
Member

@yajo please review coverage, thanks!

Functional test 👍

@pedrobaeza
Copy link
Member

@yajo, please check pending comments, and it would be good to add to the README the reasoning about not removing the element when adding to cart

@mFlayyan
Copy link

mFlayyan commented Sep 27, 2016

tested on runbot: working 👍
when tried to build I got an issue in crons 👎
BackTrace is:
openerp.addons.base.ir.ir_cron:106 _handle_callback_exception

Call of self.pool.get('wishlist.product')._garbage_collector(cr, uid, _()) failed in Job 6
Traceback (most recent call last):
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/addons/base/ir/ir_cron.py", line 129, in _callback
getattr(model, method_name)(cr, uid, *args)
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/api.py", line 250, in wrapper
return old_api(self, *args, *_kwargs)
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/api.py", line 354, in old_api
result = method(recs, _args, *_kwargs)
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/addons/website_sale_wishlist/models/wishlist_product.py", line 89, in _garbage_collector
("user_id", "=", False),
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/api.py", line 248, in wrapper
return new_api(self, _args, *_kwargs)
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/addons/website_sale_wishlist/models/wishlist_product.py", line 108, in unlink
self._clear_methods_cache()
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/api.py", line 248, in wrapper
return new_api(self, _args, *_kwargs)
File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155205-122-c9a12b/openerp/addons/website_sale_wishlist/models/wishlist_product.py", line 96, in _clear_methods_cache
Product = request.env["product.template"]
File "/srv/openerp/instances/openerp-oca-runbot/sandbox/local/lib/python2.7/site-packages/werkzeug/local.py", line 338, in getattr
return getattr(self._get_current_object(), name)
File "/srv/openerp/instances/openerp-oca-runbot/sandbox/local/lib/python2.7/site-packages/werkzeug/local.py", line 297, in _get_current_object
return self.__local()
File "/srv/openerp/instances/openerp-oca-runbot/sandbox/local/lib/python2.7/site-packages/werkzeug/local.py", line 132, in _lookup
raise RuntimeError('object unbound')
RuntimeError: object unbound

@yajo
Copy link
Member Author

yajo commented Sep 28, 2016

This is weird, the test fails, but Travis is not ❌. Do not trust him, I have to fix the test.

@yajo yajo force-pushed the 9.0-website_sale_wishlist branch 2 times, most recently from 1a81d4e to 6df6afb Compare September 28, 2016 13:55
<record id="menu_website_sale_brand" model="website.menu">
<field name="name">Shop by Brand</field>
<field name="url">/page/product_brands</field>
<field name="parent_id" ref="website_sale.menu_shop" />
<field name="sequence" type="int">25</field>
<field name="parent_id" ref="website_sale.main_menu" />
Copy link
Member

@atchuthan atchuthan Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

external id seems to be wrong, website.main_menu
https://github.com/odoo/odoo/blob/9.0/addons/website/data/data.xml#L12

Runbot fails due to this

  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155288-122-6df6af/openerp/addons/base/ir/ir_model.py", line 974, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % (xmlid))
ParseError: "External ID not found in the system: website_sale.main_menu" while parsing /srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3155288-122-6df6af/openerp/addons/website_sale_product_brand/views/product_brand.xml:61, near
<record id="menu_website_sale_brand" model="website.menu">
        <field name="name">Shop by Brand</field>
        <field name="url">/page/product_brands</field>
        <field name="sequence" type="int">25</field>
        <field name="parent_id" ref="website_sale.main_menu"/>
    </record>

For more info, check the runbot log

@atchuthan
Copy link
Member

Runbot test 👍

@yajo
Copy link
Member Author

yajo commented Sep 30, 2016

Fun.
Travis' test fails, but it gets green. It is affected by odoo/odoo#13743.
If you go to runbot and open a JS console and execute odoo.__DEBUG__.services['web.Tour'].run('test_website_sale_wishlist', 'test') as the public user, test works.
In local machine too.

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<odoo noupdate="1">

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I did not know that shortcut!

License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<odoo>

<template id="assets_frontend_demo" inherit_id="website.assets_frontend">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this case, because there is already an assets_frontend view in this addon, but this one is just for demo environments, to run tests.


current_session = fields.Char(compute="_compute_current_session")

@api.one
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@api.one is deprecated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still a little hope 🙏 . I don't consider it deprecated until that PR is closed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No hope, please fix

from openerp.http import request


class ResUsers(models.Model):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class Website

errors if you try to browse them when loaded from cache and cached
ones used a cursor that is now closed.
"""
return [record["product_tmpl_id"][0] for record in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is a bit hard to read, maybe assign the search_read to a var then perform the generator? Non-blocking



class WishlistProduct(models.Model):
_name = "wishlist.product"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly product.wishlist instead of creating a namespace for wishlists? I can't think of another use for a wishlist outside of products, and this would match pricelist naming

]

product_tmpl_id = fields.Many2one(
comodel_name="product.template",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not possible to wishlist a variant?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odoo works at template level in the e-commerce (product list, product detail). Variants are reflected through selection options in the template detail page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks for the elaboration.

comodel_name="product.template",
string="Product",
required=True,
help="Wishlisted product.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ondelete='cascade'?

@@ -6,10 +6,10 @@
<template id="product_brands" name="Brands">
<t t-call="website.layout">
<t t-set="additional_title">Product Brands</t>
<div id="wrap" t-attf-class="wrapper">
<div id="wrap" t-attf-class="wrapper">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a format string you may use t-att-class="wrapper".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this is a bug, but I prefer not to touch that. I'm only touching this file to remove a menu, seems like the space stripper changed this, but I'd prefer not to change something that could have a meaning without investigating, if you don't mind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix it, now that you have opened the Pandora's box 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I mean... should I change it for class="wrapper" or for t-att-class="wrapper"?

Copy link
Member

@pedrobaeza pedrobaeza Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good question. We need to see controller. Now I'm changing my vote for not touching this, hehe. I would bet t-att-class="wrapper", because although technically there's no % to format, it won't fail without them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's leave this as it is 😆

@pedrobaeza
Copy link
Member

@yajo, please attend @lasley's requests about model renaming an ondelete, and I'll merge.

@pedrobaeza
Copy link
Member

Check Travis

@yajo
Copy link
Member Author

yajo commented Oct 17, 2016

Rebased, let's see...

@yajo
Copy link
Member Author

yajo commented Oct 17, 2016

Please review, bots like this 😊 💚

@pedrobaeza pedrobaeza merged commit a6fb061 into OCA:9.0 Oct 18, 2016
@pedrobaeza pedrobaeza deleted the 9.0-website_sale_wishlist branch October 18, 2016 06:53
@bealdav
Copy link
Member

bealdav commented Feb 9, 2017

Hi @pedrobaeza @yajo @lasley and others.

Thanks for this nice feature

My customer would like to use it for V8.
I don't know difference between V8/V9 in website_sale_...

How much time do you think I need to backport in v8 ?

Thanks a lot.

@pedrobaeza
Copy link
Member

The backport is not easy, as JS API has changed a lot in v9, but there's an alternative implementation for v8 in #130

@bealdav
Copy link
Member

bealdav commented Feb 9, 2017

Thanks for your reply, I've seen it but my customer also seen https://www.odoo.com/apps/modules/9.0/wishlist/
available v8/v9 with 'move to cart' button with no equivalent in website_sale_wishlist.

@pedrobaeza
Copy link
Member

But that one is not from OCA. See that the repo is git@github.com:techhighway/Product-Wishlist.git#8.0

@bealdav
Copy link
Member

bealdav commented Feb 9, 2017

Yes, it was for your information, maybe pick up good ideas. Thanks

@pedrobaeza
Copy link
Member

Well, we are not working more on this for now, but any PR is welcome 😉

reinka pushed a commit to reinka/e-commerce that referenced this pull request Jun 20, 2017
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
reinka pushed a commit to reinka/e-commerce that referenced this pull request Jun 20, 2017
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
ernestotejeda pushed a commit to ernestotejeda/e-commerce that referenced this pull request Jun 4, 2018
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
pedrobaeza pushed a commit to ernestotejeda/e-commerce that referenced this pull request Jun 13, 2018
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
pedrobaeza pushed a commit to ernestotejeda/e-commerce that referenced this pull request Jun 20, 2018
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
SimoRubi pushed a commit to SimoRubi/e-commerce that referenced this pull request Oct 25, 2018
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
sergio-teruel pushed a commit to Tecnativa/e-commerce that referenced this pull request Nov 28, 2019
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
sergio-teruel pushed a commit to Tecnativa/e-commerce that referenced this pull request Nov 28, 2019
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
sergio-teruel pushed a commit to Tecnativa/e-commerce that referenced this pull request Dec 3, 2019
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
Tardo pushed a commit to Tecnativa/e-commerce that referenced this pull request Jan 30, 2020
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
SimoRubi pushed a commit to SimoRubi/e-commerce that referenced this pull request Jul 1, 2021
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.
victoralmau pushed a commit to Tecnativa/e-commerce that referenced this pull request Nov 11, 2021
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
CarlosRoca13 pushed a commit to Tecnativa/e-commerce that referenced this pull request May 24, 2022
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
miguel-S73 pushed a commit to Studio73/e-commerce that referenced this pull request Jan 30, 2023
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
ntodorova pushed a commit to initOS/e-commerce that referenced this pull request Feb 12, 2024
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants