Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

How can i detect partner created from company

形象
odoo
形象
丢弃
1 答案
0
形象
odoo
最佳答案

Hi Anhnt,

You can find the field "Contact" inside the company's General Information page. It is the partner record of the company. You can click on it to see the partner record detail.

Company's partner is creating by the create method of the company. The partner will be the same name with the "is_company" field as true,  "commercial_partner_id" as the company id and that partner has no parent record id.

Hope it will help you.


4 注释
形象
丢弃
形象
odoo
-

Thank you!
It show me which partner is company.

But I want to inherit res.partner's create function to detect that the partner is created from the company and then add my custom data to some fields.

形象
odoo
-

Instead of partner's create method, you can inherit company's create method and then you can write your datas in company "s partner.

For particular partner, you have to consider partner type and commercial_partner_id fields.

形象
odoo
-

Thank you very much!
I inherited company's create method and my problem is solved.
I had a little trouble finding the company's create method because it is base method.
But I finally found it in odoo/addons/base/models/res_company.py.

Thank you!

形象
odoo
-

Hi Anhnt,
Please vote up the answer.
Thank you.