Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
19 changes: 19 additions & 0 deletions sale_margin_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2018 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Sale Margin Security",
"version": "11.0.1.0.0",
"author": 'Tecnativa,'
'Odoo Community Association (OCA)',
"website": 'https://github.com/OCA/margin-analysis',
"category": "Sales",
"license": "AGPL-3",
"depends": [
"sale_margin",
],
"data": [
'security/sale_margin_security_security.xml',
'views/sale_margin_security_view.xml',
],
'installable': True,
}
5 changes: 5 additions & 0 deletions sale_margin_security/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To grant Sales Margin view privileges to a user:

#. Go to *Settings > Users & Companies > Users*.
#. Select the user.
#. Set *Show Sale Margin* on.
2 changes: 2 additions & 0 deletions sale_margin_security/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Sergio Teruel <sergio.teruel@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
2 changes: 2 additions & 0 deletions sale_margin_security/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to restrict the access to sale margin fields to a specific
security group of users.
2 changes: 2 additions & 0 deletions sale_margin_security/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Only the users in the group *Show Sale Margin* will be able to see sale margin
related fields in the sale lines like `margin` or `purchase_price`.
11 changes: 11 additions & 0 deletions sale_margin_security/security/sale_margin_security_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="group_sale_margin_security" model="res.groups">
<field name="name">Show Sale Margin</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>

</odoo>
19 changes: 19 additions & 0 deletions sale_margin_security/views/sale_margin_security_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record model="ir.ui.view" id="sale_margin.sale_margin_sale_order">
<field name="groups_id" eval="[(4,ref('sale_margin_security.group_sale_margin_security'))]"/>
</record>


<record model="ir.ui.view" id="sale_margin.sale_margin_sale_order_line">
<field name="groups_id" eval="[(4,ref('sale_margin_security.group_sale_margin_security'))]"/>
</record>

<record model="ir.ui.view" id="sale_margin.sale_margin_sale_order_line_form">
<field name="groups_id" eval="[(4,ref('sale_margin_security.group_sale_margin_security'))]"/>
</record>

</odoo>