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

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,


Аватар
Відмінити

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?

Найкраща відповідь

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. 

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
черв. 21
3005
3
лист. 23
8442
1
січ. 23
2584
4
січ. 22
6229
0
лют. 20
58