• Tek Siong, Hock

Odoo Sales Team for Multi-Companies and Multi-Teams

This Odoo technical development blog is my way to contribute back to the Odoo Community, for all the selfless and great sharing by the community members.


It is not uncommon in some countries which a salesperson is working for multi-companies, and therefore must be assigned to a different sales team in each company.

In the standard Odoo, this cannot be accomplished, given that it is designed to assign a salesperson to only one sales team.


The solution is pretty straight forward by creating a new "many2many" fields by replacing the standard one2many member_ids in crm.team model.


 class CRMTeam(models.Model):
    _inherit = "crm.team"
    _description = "Sales Team"

    x_member_ids = fields.Many2many('res.users', 'crm_team_res_users_rel','crm_team_id','res_users_id', 'Team Members',
                                    track_visibility='onchange')

<record id="crm_team_view_form_multi" model="ir.ui.view">
    <field name="name">Crm Team Multi</field>
    <field name="model">crm.team</field>
    <field name="inherit_id" ref="sales_team.crm_team_view_form"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='member_ids']" position="replace">
            <field name="x_member_ids"/>
        </xpath>
    </field>
</record>



Click "Like" at the bottom of this blog, to motivate us to continue sharing more Odoo tips.

8 views

©2019 by Excelroot Technology Sdn Bhd.