Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] sale_ux: backport 15 to 13 user_id allow not only internal users
closes #660 Signed-off-by: Juan Ignacio Rivero <jr@adhoc.com.ar>
- Loading branch information
1 parent
37a307d
commit fa96c48
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import api, fields, models, _ | ||
|
||
|
||
class Lead(models.Model): | ||
_inherit = 'crm.lead' | ||
|
||
user_company_ids = fields.Many2many( | ||
'res.company', compute='_compute_user_company_ids', | ||
help='UX: Limit to lead company or all if no company') | ||
|
||
@api.depends('company_id') | ||
def _compute_user_company_ids(self): | ||
all_companies = self.env['res.company'].search([]) | ||
for lead in self: | ||
if not lead.company_id: | ||
lead.user_company_ids = all_companies | ||
else: | ||
lead.user_company_ids = lead.company_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0"?> | ||
<odoo> | ||
<!-- This will be deprecated in v15 --> | ||
<record id="crm_lead_view_form" model="ir.ui.view"> | ||
<field name="name">crm.lead.form.inherit</field> | ||
<field name="model">crm.lead</field> | ||
<field name="inherit_id" ref="crm.crm_lead_view_form"/> | ||
<field name="groups_id" eval="[(4, ref('group_allow_any_user_as_salesman'))]"/> | ||
<field name="arch" type="xml"> | ||
<field name="user_id" position="before"> | ||
<field name="user_company_ids" invisible="1"/> | ||
</field> | ||
<field name="user_id" position="attributes"> | ||
<attribute name="domain">[('company_ids', 'in', user_company_ids)]</attribute> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<odoo> | ||
<!-- This will be deprecated in v15 --> | ||
<record id="crm_team_view_form" model="ir.ui.view"> | ||
<field name="name">crm.team.form.inherit</field> | ||
<field name="model">crm.team</field> | ||
<field name="inherit_id" ref="sales_team.crm_team_view_form"/> | ||
<field name="groups_id" eval="[(4, ref('group_allow_any_user_as_salesman'))]"/> | ||
<field name="arch" type="xml"> | ||
<field name="user_id" position="attributes"> | ||
<attribute name="domain">[]</attribute> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<odoo> | ||
<record id="view_contact_allow_any_user_as_salesman" model="ir.ui.view"> | ||
<field name="name">res.partner.form.salesman</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form"/> | ||
<field name="groups_id" eval="[(4, ref('group_allow_any_user_as_salesman'))]"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//group/field[@name='user_id']" position='attributes'> | ||
<attribute name="domain">[]</attribute> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |