İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
8357 Görünümler

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,


Avatar
Vazgeç

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?

En İyi Yanıt

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. 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Haz 21
2955
3
Kas 23
8411
1
Oca 23
2559
4
Oca 22
6192
0
Şub 20
58