تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3885 أدوات العرض

Hello Odoo Community,

 

Building a custom model in Odoo studio is great, as it gives me the option to extend or build new ERP features. Odoo Studio also provides the possibility to add a Form on the website to allow a website or portal user to Create records in a custom model.

 

I'd like to enable a website portal user to Read, Update, and Delete records that they created in a custom model.

 

How can I do that through Odoo Studio? 

 

Especially when the only available website component in Odoo Studio and Odoo Website Builder is a Form, but no List, or Table, or similar dynamic content components.


الصورة الرمزية
إهمال
أفضل إجابة

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:

  1. 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
  1. 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.
    
        
    

  1. 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.
  1. 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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أكتوبر 22
1513
0
أغسطس 22
3
0
ديسمبر 21
51
0
أكتوبر 21
20
test تم الحل
1
يوليو 19
4