Hello everyone,
I am encountering an issue with my Odoo setup where I want users to register pets via a form on the website. However, the problem is that the logged-in user is not being linked to the pet record when the form is submitted. Here are the details:
Setup Details:
- Pet Model Fields:
- Name
- Type
- Description
- Age
- Contact (Many2one field linking to res.partner)
- User Model Fields:
- Name
- Phone Number
- Language
- Total Pets (One2many field linking to pet with inverse field Contact)
Issue:
When a user submits the pet registration form on the website:
- The pet record is created successfully.
- The Contact field in the pet record is not populated with the logged-in user.
- The Owner has to manually select his Contact record. I don't want the logged in user to be able to see other contacts records e.g. should be only able to see his/her own name.
Request for Help:
I need guidance on the following:
- How to automatically link the logged-in user to the pet record when the form is submitted on the website.
- Ensuring that the Total Pets field in the User model updates correctly when a new pet is registered.
Any help or insights into resolving this issue would be greatly appreciated. If there's a better way to achieve this, please let me know. Thank you!
Best regards, Khachaturyan Alain