Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1167 Переглядів

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


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
січ. 25
1357
1
бер. 25
1285
0
січ. 25
1010
0
черв. 24
1664
2
лип. 25
814