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.

1

JS Odoo session expired

By
PY
on 3/23/15, 11:20 AM 1,587 views

Hi ! I'm on Odoo (v8).

I have a custom web page that create a custom product. The form point to the /shop/cart/update route of the website_sale module.

When I'm not logged in (visitor), I have this error in the JS console:


"Server application error" Object { message: "Odoo Session Expired", code: 100, data: Object }

declare/genericJsonRpc/result<()

.Deferred/promise.then/</</<()

jQuery.Callbacks/fire()

jQuery.Callbacks/self.fireWith()

done()

.send/callback()


I suppose that a user must at least log in as portal user to add products to their carts.

But then, if I use the shop defined by the same website_sale module, by adding products to the cart, that work, even as a visitor !


How they manage to do that ? I can't figure out by viewing the code.

thanks for the help !


0
PY
On 3/24/15, 6:25 AM

I think I got it. I still have to try this out but, we'll se.

In fact, I just had to look closer to the js files of the website_sale module. Their JS code is doing json requests on the controller's functions. My JS code was doing json request on my models.Model's functions. And because Model have access rights, I think that's why visitors couldn't trigger my json calls.

I will confirm this if I get this to work.

Update:

I have an issue that I will cover myself or ask in another thread. But this is the solution.

0

Axel Mendoza

--Axel Mendoza--
10238
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 7/9/15, 7:34 PM

Because of you are firing request against your models functions you need a db parameter setted in you OpenERPSession at the server side, this only get setted when you login ok, if you are not logged you dont have a db setted in your session and any call for using models for Odoo seems that your session have expired

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

2 follower(s)

Stats

Asked: 3/23/15, 11:20 AM
Seen: 1587 times
Last updated: 10/3/16, 9:11 AM