Skip to Content
Menu
This question has been flagged

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:

  1. Pet Model Fields:
    • Name
    • Type
    • Description
    • Age
    • Contact (Many2one field linking to res.partner)
  2. User Model Fields:
    • Name
    • Email
    • 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:

  1. How to automatically link the logged-in user to the pet record when the form is submitted on the website.
  2. 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


Avatar
Discard
Related Posts Replies Views Activity
1
Jan 25
1139
1
Mar 25
959
0
Jan 25
824
0
Jun 24
1464
2
Jul 25
491