[IMP] sales_team: Make sales team company specific

This commit is contained in:
Hitesh Trivedi
2015-06-15 09:09:56 +02:00
committed by Richard Mathot
parent 839b739ab5
commit 0bfb7d6915
4 changed files with 10 additions and 1 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ class PlannerCrm(models.Model):
@api.model
def _prepare_planner_crm_data(self):
sales_team = self.env.ref('sales_team.team_sales_department')
# sudo is needed to avoid error message when current user's company != sale_department company
sales_team = self.sudo().env.ref('sales_team.team_sales_department')
values = {
'alias_domain': sales_team.alias_domain,
'alias_name': sales_team.alias_name,
+1
View File
@@ -44,6 +44,7 @@ class crm_team(osv.Model):
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to "\
"true, it will allow you to hide the sales team without removing it."),
'company_id': fields.many2one('res.company', 'Company'),
'change_responsible': fields.boolean('Reassign Escalated', help="When escalating to this team override the salesman with the team leader."),
'user_id': fields.many2one('res.users', 'Team Leader'),
'member_ids': fields.many2many('res.users', 'sale_member_rel', 'team_id', 'member_id', 'Team Members'),
+2
View File
@@ -98,6 +98,8 @@
</group>
<group>
<field name="active"/>
<field name="company_id" groups="base.group_multi_company"
options="{'no_create': True}"/>
</group>
</group>
</page>
@@ -5,5 +5,10 @@
<field name="name">Manage Sales Teams</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record model="ir.rule" id="sale_team_comp_rule">
<field name="name">Sales Team multi-company</field>
<field name="model_id" ref="model_crm_team"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>