Odoo Help

Welcome!

This community 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.

0

Should the cart be persistent in Odoo 8?

By
Pascal Tremblay
on 11/10/16, 12:59 PM 172 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--
1312
| 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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