Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3743 Widoki

Hello,

I am using Odoo15, and I am trying to assign the current default company to company_id field when creating a record in 'res.partner' using the following code : 


This works fine when creating a record directly from 'res.partner' model (Suppliers/ Clients menus), also when creating a new record in 'res.users' (this automatically creates a record in res.parner), the problem appears when I try creating a new company, I get the following user error : 

I guess the error occurred because I am trying to fill the company_id field in res.partner with another company_id that does not match with the new_cmpany. 

I have tried adding a condition, to separate the case of creating a company from other cases (user, supplier, client):

In the first case, keep the company_id field empty
The other cases use the assignment shown in the code, but unfortunately the condition did not work

Any suggestions please to solve this. 

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Kahina,

Thank you for the code to insert the default company, 

i am facing the same problem, i am new to python and odoo, have you found a solution for this issue ?


 thank you in advance.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sty 23
1632
1
lut 20
4241
1
lip 24
2187
1
lut 23
2523
1
wrz 22
2344