Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Can companies share the same partner ? In which scenarios ?

Yurdik Cervantes Mendoza
on 10/2/15, 7:34 PM 418 views


I have seen the odoo code for the creation of a new company:

def create(self, cr, uid, vals, context=None):
if not vals.get('name', False) or vals.get('partner_id', False):
return super(res_company, self).create(cr, uid, vals, context=context)
obj_partner = self.pool.get('res.partner')
partner_id = obj_partner.create(cr, uid, {'name': vals['name'], 'is_company':True, 'image': vals.get('logo', False)}, context=context)
vals.update({'partner_id': partner_id})
company_id = super(res_company, self).create(cr, uid, vals, context=context)
obj_partner.write(cr, uid, [partner_id], {'company_id': company_id}, context=context)
return company_id

The first three lines seems to allow the new company to be created using the specified partner..

This seems to intentionally omit the association of the given partner to the newly created company (the line before the last return).

Is this a bug or they want to allow a company to share the partner with another company ? In which scenarios would this be useful ?.

Best regards

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 10/2/15, 7:34 PM
Seen: 418 times
Last updated: 10/3/15, 9:44 AM