Skip to content

Commit

Permalink
[MIG] crm_security_group: Migration to 16.0
Browse files Browse the repository at this point in the history
TT45865
  • Loading branch information
victoralmau committed Nov 10, 2023
1 parent c239e65 commit cdce3c5
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 25 deletions.
14 changes: 7 additions & 7 deletions crm_security_group/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CRM Only Security Groups
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9ec668f2b61df28fba57c5d0e114f71e489f06d8b65c51f9b297eaab0c2b6145
!! source digest: sha256:9bd268e2f74a9fcfab1fdb5e2a80aa9a0f11c96f7a6a2b770c7b8dc0e22200a2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ CRM Only Security Groups
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github
:target: https://github.com/OCA/crm/tree/15.0/crm_security_group
:target: https://github.com/OCA/crm/tree/16.0/crm_security_group
:alt: OCA/crm
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/crm-15-0/crm-15-0-crm_security_group
:target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_security_group
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -38,15 +38,15 @@ This module adds new security options to CRM by creating 3 groups (Own Documents
Known issues / Roadmap
======================

- Remove sale_crm dependency (now is not possible), maybe split these part in other addon
- Remove sale_crm dependency (now is not possible), maybe split this part in other addon

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/crm/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_security_group%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_security_group%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -86,6 +86,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/15.0/crm_security_group>`_ project on GitHub.
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/16.0/crm_security_group>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 3 additions & 1 deletion crm_security_group/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "CRM Only Security Groups",
"summary": "Add new group in Sales to show only CRM",
"version": "15.0.1.2.0",
"version": "16.0.1.0.0",
"category": "Customer Relationship Management",
"website": "https://github.com/OCA/crm",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand All @@ -16,6 +16,8 @@
"data": [
"security/security.xml",
"security/ir.model.access.csv",
"views/crm_lead_views.xml",
"views/crm_team_views.xml",
"views/menu_items.xml",
],
}
2 changes: 1 addition & 1 deletion crm_security_group/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Remove sale_crm dependency (now is not possible), maybe split these part in other addon
- Remove sale_crm dependency (now is not possible), maybe split this part in other addon
10 changes: 5 additions & 5 deletions crm_security_group/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">CRM Only Security Groups</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9ec668f2b61df28fba57c5d0e114f71e489f06d8b65c51f9b297eaab0c2b6145
!! source digest: sha256:9bd268e2f74a9fcfab1fdb5e2a80aa9a0f11c96f7a6a2b770c7b8dc0e22200a2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/crm/tree/15.0/crm_security_group"><img alt="OCA/crm" src="https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/crm-15-0/crm-15-0-crm_security_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/crm&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/crm/tree/16.0/crm_security_group"><img alt="OCA/crm" src="https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_security_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/crm&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds new security options to CRM by creating 3 groups (Own Documents Only, All Documents and Administrator) to separate Sales and CRM apps permissions</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -387,15 +387,15 @@ <h1 class="title">CRM Only Security Groups</h1>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-1">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Remove sale_crm dependency (now is not possible), maybe split these part in other addon</li>
<li>Remove sale_crm dependency (now is not possible), maybe split this part in other addon</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/crm/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/crm/issues/new?body=module:%20crm_security_group%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/crm/issues/new?body=module:%20crm_security_group%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -424,7 +424,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/crm/tree/15.0/crm_security_group">OCA/crm</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/crm/tree/16.0/crm_security_group">OCA/crm</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion crm_security_group/tests/test_crm_security.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Copyright 2021-2022 Tecnativa - Víctor Martínez
# Copyright 2021-2023 Tecnativa - Víctor Martínez
# License LGPL-3 - See https://www.gnu.org/licenses/lgpl-3.0.html

from odoo.exceptions import AccessError
from odoo.tests import Form, common, new_test_user
from odoo.tests.common import users

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestCrmSecurity(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
group_crm_all_leads = "crm_security_group.group_crm_all_leads"
group_sale_salesman_all_leads = "sales_team.group_sale_salesman_all_leads"
new_test_user(
Expand All @@ -29,6 +32,8 @@ def setUpClass(cls):
)
cls.crm_menu = cls.env.ref("crm.crm_menu_root")
cls.sale_menu = cls.env.ref("sale.sale_menu_root")
# Force to active sale_menu_root (similar with sale_management installed)
cls.sale_menu.active = True
# create items to test after
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
cls.crm_lead = cls.env["crm.lead"].sudo().create({"name": "Lead"})
Expand Down
19 changes: 19 additions & 0 deletions crm_security_group/views/crm_lead_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="crm_case_form_view_oppor" model="ir.ui.view">
<field name="name">crm.lead.oppor.inherited.crm</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="sale_crm.crm_case_form_view_oppor" />
<field name="arch" type="xml">
<button name="action_sale_quotations_new" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</button>
<button name="action_view_sale_quotation" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</button>
<button name="action_view_sale_order" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</button>
</field>
</record>
</odoo>
90 changes: 90 additions & 0 deletions crm_security_group/views/crm_team_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="sales_team_crm_team_view_kanban_dashboard" model="ir.ui.view">
<field name="name">sales_team.team.view.kanban.dashboard.inherit.sale</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sales_team.crm_team_view_kanban_dashboard" />
<field name="arch" type="xml">
<button name="action_primary_channel_button" position="attributes">
<attribute
name="groups"
>crm_security_group.group_crm_own_leads</attribute>
</button>
</field>
</record>
<record id="sale_crm_team_view_kanban_dashboard" model="ir.ui.view">
<field name="name">sale_crm.team.view.kanban.dashboard.inherit.sale</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sale.crm_team_view_kanban_dashboard" />
<field name="arch" type="xml">
<field name="use_quotations" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</field>
<field name="invoiced_target" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</field>
<xpath
expr="//div[@t-if='record.quotations_count.raw_value']"
position="attributes"
>
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</xpath>
<xpath expr="//div[@name='orders_to_invoice']" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</xpath>
<xpath
expr="//div[@t-if='record.use_quotations.raw_value']"
position="attributes"
>
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</xpath>
<xpath expr="//div[@name='sales_report']" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</xpath>
</field>
</record>
<record id="crm_team_view_kanban_dashboard" model="ir.ui.view">
<field name="name">crm.team.view.kanban.dashboard.inherit.sale</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="crm.crm_team_view_kanban_dashboard" />
<field name="arch" type="xml">
<xpath
expr="//div[@t-if='record.lead_unassigned_count.raw_value']"
position="attributes"
>
<attribute
name="groups"
>crm_security_group.group_crm_own_leads</attribute>
</xpath>
<xpath
expr="//div[@t-if='record.opportunities_count.raw_value']"
position="attributes"
>
<attribute
name="groups"
>crm_security_group.group_crm_own_leads</attribute>
</xpath>
<xpath
expr="//div[@t-if='record.opportunities_overdue_count.raw_value']"
position="attributes"
>
<attribute
name="groups"
>crm_security_group.group_crm_own_leads</attribute>
</xpath>
<xpath
expr="//div[@t-if='record.use_opportunities.raw_value']"
position="attributes"
>
<attribute
name="groups"
>crm_security_group.group_crm_own_leads</attribute>
</xpath>
<xpath expr="//div[@name='activity_report']" position="attributes">
<attribute
name="groups"
>crm_security_group.group_crm_own_leads</attribute>
</xpath>
</field>
</record>
</odoo>
10 changes: 0 additions & 10 deletions crm_security_group/views/menu_items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,4 @@
eval="[(4, ref('crm_security_group.group_crm_manager'))]"
/>
</record>
<record id="sale_crm.crm_case_form_view_oppor" model="ir.ui.view">
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]" />
</record>
<!-- It's necessary to show sale button in partner view only if user have sale group!-->
<record id="sale.res_partner_view_buttons" model="ir.ui.view">
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]" />
</record>
<record id="sale.crm_team_view_kanban_dashboard" model="ir.ui.view">
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]" />
</record>
</odoo>

0 comments on commit cdce3c5

Please sign in to comment.