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

Hello, 


I want to solve this error 


Something went wrong !

×

Incompatible companies on records: - 'com/MO/05031 - product ref. - product name' belongs to company 'company name' and 'Leave' (leave_id: 'com/MO/05031 - routing name) belongs to another company.


waiting anyones help,

Thanks in advance,


Awatar
Odrzuć

Hi!! Same error while creating a new company!! Any news?

Hello Iman,

Kindly, check the product configuration.
Like selected product allow for a single company or multiple company?

Najlepsza odpowiedź

Hello,

I faced this issue in Odoo 15, and I was investigating for the cause of it, I suspected that it was a customization made which caused it so took a backup and I began to uninstall all custom modules but the error still pop up. I created a new database installing the native modules I am using but the error did not pop up which is very strange, on debugging the code I found that on creating a new company the partner_id is created with a company_id equal 1 not the id of the company which is being created, honestly I do not know why? as the regular behavior to be equal False or equal to the id of the company being created.

 Finally I fixed this issue by overriding the create method of the res.company:

class Company(models.Model):
_inherit = "res.company"

@api.model
def create(self, vals):
company = super(Company, self).create(vals)
# Add the following line to avoid user error: Incompatible companies on records.
company.partner_id.company_id = company.id # or you can make it = False
return company

I hope it helps someone. 

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
cze 21
2596
3
lis 23
7567
1
sty 23
2031
4
sty 22
5626
0
lut 20
58