-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] sale_margin_security: Allows more flexibility in groups
As in some flows, people want to split fields visibility to buyers and salesmen, restore the margin group. As in cost module, there is two groups, add a group for sale margins + edit costs
- Loading branch information
1 parent
1227f62
commit cef55d7
Showing
8 changed files
with
70 additions
and
15 deletions.
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
25 changes: 25 additions & 0 deletions
25
sale_margin_security/migrations/16.0.3.2.0/post-migrate.py
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,25 @@ | ||
# Copyright 2024 Moduon Team S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) | ||
from odoo import SUPERUSER_ID, api | ||
|
||
|
||
def migrate(cr, version): | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
|
||
users_read = env["res.users"].search( | ||
[("groups_id", "in", env.ref("product_cost_security.group_product_cost").ids)] | ||
) | ||
users_read.groups_id += env.ref("sale_margin_security.group_sale_margin_security") | ||
|
||
users_edit = env["res.users"].search( | ||
[ | ||
( | ||
"groups_id", | ||
"in", | ||
env.ref("product_cost_security.group_product_edit_cost").ids, | ||
) | ||
] | ||
) | ||
users_edit.groups_id += env.ref( | ||
"sale_margin_security.group_sale_margin_edit_security" | ||
) |
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,22 @@ | ||
<?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 (and Show Costs)</field> | ||
<field name="category_id" ref="base.module_category_hidden" /> | ||
<field | ||
name="implied_ids" | ||
eval="[(4, ref('product_cost_security.group_product_cost'))]" | ||
/> | ||
</record> | ||
|
||
<record id="group_sale_margin_edit_security" model="res.groups"> | ||
<field name="name">Show Sale Margin (and Edit Costs)</field> | ||
<field name="category_id" ref="base.module_category_hidden" /> | ||
<field | ||
name="implied_ids" | ||
eval="[(4, ref('group_sale_margin_security')), (4, ref('product_cost_security.group_product_edit_cost'))]" | ||
/> | ||
</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
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