Odoo Help

0

Should the cart be persistent in Odoo 8?

By
Pascal Tremblay
on 11/10/16, 12:59 PM 314 views

Hello there,

We have an Odoo 8 running with the last nightly code ( 9 novembre 2016).

With this version, should the cart be persistent after a logout/login of a visitor?

If a customer put some items in his cart on the shop, and he logs out, After he log again, should the items be still in his cart?

For the moment here, the cart is lost after each logout...

We ask it because we have many custom modules installed. Before to search the problem, we want to know if it should work or not...

Thanks


I have tested with a new clean server. No custom module. Just installed ecommerce module. The cart doesn't seem to be persistent... How could I solve it?

Pascal Tremblay
on 11/10/16, 1:27 PM
0

Pascal Tremblay

--Pascal Tremblay--
1563
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 11/10/16, 3:42 PM

It seems to work now.

We put this code in a custom module :


class website_pt(orm.Model):
    _inherit = 'website'  
    def sale_get_order(self, cr, uid, ids, force_create=False, code=None, update_pricelist=None, context=None):
        sale_order_obj = self.pool['sale.order']
        sale_order_id = request.session.get('sale_order_id')
        sale_order = None
        # Cette partie a ete ajoutee afin que le panier se conserve quand un utilisateur revient.
        # https://github.com/odoo/odoo/issues/3339
        if not sale_order_id:
            partner = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id
             if partner and partner.id != 4: #(4 est le id du public user partner)
                domain = [('partner_id','=',partner.id), ('state','=','draft')]
                sale_order_id = sale_order_obj.search(cr, SUPERUSER_ID, domain, limit=1, context=context)


To override this code of the file odoo-8.0-20161109/openerp/addons/website_sale/models/sale_order.py  :


class website(orm.Model):
    _inherit = 'website'
    def sale_get_order(self, cr, uid, ids, force_create=False, code=None, update_pricelist=None, context=None):
        sale_order_obj = self.pool['sale.order']
        sale_order_id = request.session.get('sale_order_id')
        sale_order = None

Source : https://github.com/odoo/odoo/issues/3339

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/10/16, 12:59 PM
Seen: 314 times
Last updated: 11/11/16, 2:51 PM