Good morning, I am working with http.Controllers in odoo v.12, I want to pass the id through the url to get the following:
http://localhost:8069/my_library/book_details/1
The code I am using is:
from odoo import http
class Book(http.Controller):
@http.route('/my_library/book_details/<model("library.book"):book>', type='http', auth='none')
def book_details_in_path (self, book):
print (book)
However I receive the following error message:
psycopg2.ProgrammingError: can't adapt type 'RequestUID'
what am I doing wrong?
Thank you so much.
In case you define the type of authentication method to none
, The request code will not have any facilities to access the database nor have any configuration indicating the current database nor the current user.
In route definition, you called model
which provides records directly when given their id and the authentication method used will not allow that.
To avoid this issue just change the authentication method.