In Odoo Studio, you can enable website portal users to read, update, and delete records in a custom model by creating a custom website page that displays the records and provides the necessary functionality. Here's an example of how this can be done:
- Create a custom controller: Create a new Python file in your custom module and define a new controller that inherits from the http.Controller class. This controller will handle the logic for displaying the records and providing the necessary functionality.
from odoo import http
class MyController(http.Controller):
@http.route('/my_controller', auth='user', website=True)
def my_controller(self, **kwargs):
# your logic here
- Create a custom template: Create a new XML template file in your custom module and define the template for the custom page. This template should display the records and provide buttons or links for the read, update, and delete functionality.
- Add the custom page to the website menu: In your custom module, create a new XML file and define a new menu item that links to the custom page. This menu item should be added to the website menu so that it is visible to website users.
- Add the necessary logic in the controller : In your custom controller, you need to add the logic to fetch the records, handle the updates, and handle the deletions, using the ORM methods for that.
It's important to note that this is just an example and should be adapted to your specific use case, and you should also make sure that you are providing the proper security and access rights for the website users to edit and delete the records.
You can also use the website_form module and override the views and templates to add the functionality you want, and use the access_token for the user identification.
It's also important to test the changes before applying them in production as it may have side effects on other parts of the system.