@ -0,0 +1,48 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
User Warehouse Restriction |
||||
|
========================== |
||||
|
This module helps you to restrict warehouse and stock location for the users. |
||||
|
So that users can only access the allowed warehouse and locations. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* Enable 'Restrict stock warehouse to users' from inventory configuration settings |
||||
|
* Restrict warehouse and stock location for the users. |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License v3.0 (AGPL v3) |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V18) Unnimaya CO, Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import models |
@ -0,0 +1,47 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
{ |
||||
|
'name': "User Warehouse Restriction", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Warehouse', |
||||
|
'summary': """Restrict Warehouses and location for users.""", |
||||
|
'description': """This module helps you to restrict warehouse and stock |
||||
|
location for the specific users. So that users can only access the allowed |
||||
|
warehouse and locations.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['stock_sms'], |
||||
|
'data': [ |
||||
|
'security/user_warehouse_restriction_groups.xml', |
||||
|
'security/user_warehouse_restriction_security.xml', |
||||
|
'views/res_config_settings_views.xml', |
||||
|
'views/stock_warehouse_views.xml', |
||||
|
'views/res_users_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
## Module <user_warehouse_restriction> |
||||
|
|
||||
|
#### 04.08.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial commit for User Warehouse Restriction |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO(odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import res_config_settings |
||||
|
from . import res_users |
||||
|
from . import stock_picking |
||||
|
from . import stock_warehouse |
@ -0,0 +1,62 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
import logging |
||||
|
from odoo import api, fields, models |
||||
|
from odoo.exceptions import AccessError |
||||
|
|
||||
|
_logger = logging.getLogger(__name__) |
||||
|
|
||||
|
|
||||
|
class ResConfigSettings(models.TransientModel): |
||||
|
"""Add new fields to configuration settings to Restrict stock warehouse |
||||
|
for users.""" |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
group_user_warehouse_restriction = fields.Boolean( |
||||
|
string="Restrict Stock Warehouse", |
||||
|
implied_group='user_warehouse_restriction.' |
||||
|
'user_warehouse_restriction_group_user', |
||||
|
help="Check if you want to restrict warehouse for users.") |
||||
|
|
||||
|
@api.onchange('group_user_warehouse_restriction') |
||||
|
def _onchange_group_user_warehouse_restriction(self): |
||||
|
"""This method is triggered when the 'group_user_warehouse_restriction' |
||||
|
field is changed. if it's true, assigns the current user as the |
||||
|
allowed user of all existing warehouses.""" |
||||
|
rule = self.env.ref('user_warehouse_restriction.operation_type_rule_users', raise_if_not_found=False) |
||||
|
if rule: |
||||
|
rule.active = False |
||||
|
try: |
||||
|
warehouses = self.env['stock.warehouse'].search([]) |
||||
|
for warehouse in warehouses: |
||||
|
if self.group_user_warehouse_restriction: |
||||
|
# Assign the current user to each warehouse |
||||
|
if not warehouse.user_ids: |
||||
|
warehouse.user_ids = [(6, 0, [self.env.user.id])] |
||||
|
else: |
||||
|
# Clear the allowed users for each warehouse |
||||
|
warehouse.user_ids = [(5, 0, 0)] |
||||
|
except AccessError as e: |
||||
|
_logger.warning(f"Access error occurred: {e}") |
||||
|
finally: |
||||
|
if rule: |
||||
|
rule.active = True |
@ -0,0 +1,51 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ResUsers(models.Model): |
||||
|
"""This model adds additional fields to the `res.users` model to restrict |
||||
|
user access to certain locations and warehouses.""" |
||||
|
_inherit = 'res.users' |
||||
|
|
||||
|
restrict_location = fields.Boolean(string="Restrict Location", |
||||
|
help='Restrict location for the user.') |
||||
|
location_ids = fields.Many2many(comodel_name='stock.location', |
||||
|
string='Restricted Locations', |
||||
|
help='Restricted locations for users.') |
||||
|
allowed_warehouse_ids = fields.Many2many( |
||||
|
comodel_name='stock.warehouse', string='Allowed Warehouse', |
||||
|
help='Allowed Warehouse for user.') |
||||
|
check_user = fields.Boolean(string="Check", compute='_compute_check_user', |
||||
|
help="Indicates whether the user has warehouse" |
||||
|
" location restrictions.") |
||||
|
|
||||
|
def _compute_check_user(self): |
||||
|
"""To determine if the user has warehouse location restrictions. |
||||
|
Sets the check_user field accordingly.""" |
||||
|
for record in self: |
||||
|
record.check_user = False |
||||
|
record.restrict_location = False |
||||
|
if self.env.user.has_group( |
||||
|
'user_warehouse_restriction.user_warehouse_restriction_group_user'): |
||||
|
record.check_user = True |
||||
|
record.restrict_location = True |
@ -0,0 +1,38 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, models |
||||
|
|
||||
|
|
||||
|
class StockPicking(models.Model): |
||||
|
"""Extends stock picking to apply domain restrictions based on user's |
||||
|
assigned warehouses.""" |
||||
|
_inherit = 'stock.picking' |
||||
|
|
||||
|
@api.onchange('location_id', 'location_dest_id') |
||||
|
def _onchange_location_id(self): |
||||
|
"""Domain for location_id and location_dest_id.""" |
||||
|
if self.env['ir.config_parameter'].sudo().get_param('user_warehouse_restriction.group_user_warehouse_restriction'): |
||||
|
return { |
||||
|
'domain': {'location_id': [ |
||||
|
('warehouse_id.user_ids', 'in', self.env.user.id)], |
||||
|
'location_dest_id': [ |
||||
|
('warehouse_id.user_ids', 'in', self.env.user.id)]}} |
@ -0,0 +1,65 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Unnimaya CO (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class StockWarehouse(models.Model): |
||||
|
"""Extends the 'stock.warehouse' model to add functionality for restricting |
||||
|
stock location access to specific users within the system.""" |
||||
|
_inherit = "stock.warehouse" |
||||
|
|
||||
|
user_ids = fields.Many2many( |
||||
|
comodel_name='res.users', string='Allowed Users', |
||||
|
domain=lambda self: [ |
||||
|
('groups_id', 'in', self.env.ref('stock.group_stock_user').id)], |
||||
|
# default=lambda self: self.env.user, |
||||
|
help='Users who are allowed access to this warehouse.') |
||||
|
restrict_location = fields.Boolean( |
||||
|
string='Restrict Stock Location for this Warehouse', |
||||
|
help='Restrict stock location of this warehouse to the selected ' |
||||
|
'users.') |
||||
|
|
||||
|
@api.onchange('restrict_location', 'user_ids') |
||||
|
def _onchange_restrict_location(self): |
||||
|
"""Triggered when the 'restrict_location' or 'user_ids' fields |
||||
|
are modified. It updates the 'restrict_location' field for selected |
||||
|
users when restricting stock location access.""" |
||||
|
for rec in self.user_ids: |
||||
|
if self.restrict_location: |
||||
|
rec._origin.write({'restrict_location': True, |
||||
|
'allowed_warehouse_ids': [ |
||||
|
(4, self._origin.id)]}) |
||||
|
elif not self.restrict_location: |
||||
|
rec._origin.write({'restrict_location': True, |
||||
|
'location_ids': False |
||||
|
}) |
||||
|
|
||||
|
def action_open_users_view(self): |
||||
|
"""Return user basic form view to give restricted location for users""" |
||||
|
return { |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'name': 'Users', |
||||
|
'view_mode': 'list,form', |
||||
|
'res_model': 'res.users', |
||||
|
'domain': [('id', 'in', [user.id for user in self.user_ids]), |
||||
|
('groups_id', 'not in', |
||||
|
[self.env.ref('base.group_system').id])]} |
@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- New user group created for Warehouse restriction --> |
||||
|
<record id="user_warehouse_restriction_group_user" model="res.groups"> |
||||
|
<field name="name">Restrict Warehouse for Users</field> |
||||
|
<field name="category_id" ref="base.module_category_hidden"/> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,52 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Users should only see operation types that belong to the warehouse they belong to --> |
||||
|
<record id="operation_type_rule_users" model="ir.rule"> |
||||
|
<field name="name">Operation Type Restrict on Users</field> |
||||
|
<field name="model_id" ref="stock.model_stock_picking_type"/> |
||||
|
<field name="domain_force">[('warehouse_id.user_ids','in', user.id)]</field> |
||||
|
<field name="groups" eval="[(4, ref('user_warehouse_restriction.user_warehouse_restriction_group_user'))]"/> |
||||
|
<field name="perm_read" eval="True"/> |
||||
|
<field name="perm_write" eval="True"/> |
||||
|
<field name="perm_create" eval="True"/> |
||||
|
<field name="perm_unlink" eval="True"/> |
||||
|
<field name="active" eval="True"/> |
||||
|
</record> |
||||
|
<!-- Users should only see Stock Location that they are not restricted to--> |
||||
|
<record id="stock_location_rule_users" model="ir.rule"> |
||||
|
<field name="name">Stock Location Restrict on Users</field> |
||||
|
<field name="model_id" ref="stock.model_stock_location"/> |
||||
|
<field name="domain_force">[('id', 'not in', user.location_ids.ids)]</field> |
||||
|
<field name="groups" eval="[(4, ref('user_warehouse_restriction.user_warehouse_restriction_group_user'))]"/> |
||||
|
<field name="perm_read" eval="True"/> |
||||
|
<field name="perm_write" eval="True"/> |
||||
|
<field name="perm_create" eval="True"/> |
||||
|
<field name="perm_unlink" eval="True"/> |
||||
|
<field name="active" eval="True"/> |
||||
|
</record> |
||||
|
<!-- Users should only see the allowed warehouse--> |
||||
|
<record id="stock_warehouse_rule_users" model="ir.rule"> |
||||
|
<field name="name">Warehouse Restrict on Users</field> |
||||
|
<field name="model_id" ref="stock.model_stock_warehouse"/> |
||||
|
<field name="domain_force">[('user_ids','in', user.id)]</field> |
||||
|
<field name="groups" eval="[(4, ref('user_warehouse_restriction.user_warehouse_restriction_group_user'))]"/> |
||||
|
<field name="perm_read" eval="True"/> |
||||
|
<field name="perm_write" eval="True"/> |
||||
|
<field name="perm_create" eval="True"/> |
||||
|
<field name="perm_unlink" eval="True"/> |
||||
|
<field name="active" |
||||
|
eval="True"/> |
||||
|
</record> |
||||
|
<!-- Users should only see transfers of allowed warehouse--> |
||||
|
<record id="stock_picking_rule_users" model="ir.rule"> |
||||
|
<field name="name">Warehouse Transfers Restrict on Users</field> |
||||
|
<field name="model_id" ref="stock.model_stock_picking"/> |
||||
|
<field name="domain_force">[('picking_type_id.warehouse_id.user_ids','in', user.id)]</field> |
||||
|
<field name="groups" eval="[(4, ref('user_warehouse_restriction.user_warehouse_restriction_group_user'))]"/> |
||||
|
<field name="perm_read" eval="True"/> |
||||
|
<field name="perm_write" eval="True"/> |
||||
|
<field name="perm_create" eval="True"/> |
||||
|
<field name="perm_unlink" eval="True"/> |
||||
|
<field name="active" eval="True"/> |
||||
|
</record> |
||||
|
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 176 KiB |
After Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 787 KiB |
After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,19 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- Inventory settings form view inherited --> |
||||
|
<record id="res_config_settings_view_form" model="ir.ui.view"> |
||||
|
<field name="name">res.config.settings.view.form.inherit.user.warehouse.restriction</field> |
||||
|
<field name="model">res.config.settings</field> |
||||
|
<field name="priority" eval="1"/> |
||||
|
<field name="inherit_id" ref="stock.res_config_settings_view_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//setting[@id='use_own_routes']" position="after"> |
||||
|
<setting id="warehouse_restriction" |
||||
|
invisible="group_stock_multi_locations == False" |
||||
|
help="Enable Warehouse restriction"> |
||||
|
<field name="group_user_warehouse_restriction" on_change="1"/> |
||||
|
</setting> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,43 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Added fields for accessible location --> |
||||
|
<record id="view_users_form" model="ir.ui.view"> |
||||
|
<field name="name">res.users.view.form.inherit.user.warehouse.restriction |
||||
|
</field> |
||||
|
<field name="model">res.users</field> |
||||
|
<field name="mode">extension</field> |
||||
|
<field name="inherit_id" ref="base.view_users_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//page[@name='preferences']" position="after"> |
||||
|
<page name="stock_location" string="Restricted Location" |
||||
|
invisible="not restrict_location"> |
||||
|
<group> |
||||
|
<field name="allowed_warehouse_ids" widget="many2many_tags"/> |
||||
|
<field name="location_ids" widget="many2many_tags" |
||||
|
domain="[('warehouse_id', 'in', allowed_warehouse_ids)]"/> |
||||
|
<field name="restrict_location" invisible="1"/> |
||||
|
<field name="check_user" invisible="1"/> |
||||
|
</group> |
||||
|
</page> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Users simple form view inherited--> |
||||
|
<record id="view_users_simple_form" model="ir.ui.view"> |
||||
|
<field name="name">res.users.view.form.user.warehouse.restriction |
||||
|
</field> |
||||
|
<field name="model">res.users</field> |
||||
|
<field name="inherit_id" ref="base.view_users_simple_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<group name="phone_numbers" position="after"> |
||||
|
<group name="Warehouses"> |
||||
|
<field name="allowed_warehouse_ids" widget="many2many_tags" readonly="True"/> |
||||
|
<field name="location_ids" widget="many2many_tags" |
||||
|
domain="[('warehouse_id', 'in', allowed_warehouse_ids)]"/> |
||||
|
<field name="restrict_location" invisible="1"/> |
||||
|
<field name="check_user" invisible="1"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,40 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- New page on Stock Warehouse form view--> |
||||
|
<record id="view_warehouse" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
stock.warehouse.view.form.inherit.user.warehouse.restriction |
||||
|
</field> |
||||
|
<field name="model">stock.warehouse</field> |
||||
|
<field name="priority" eval="1"/> |
||||
|
<field name="inherit_id" ref="stock.view_warehouse"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//notebook[@colspan='4' and @groups='stock.group_adv_location,stock.group_stock_multi_warehouses']" |
||||
|
position="attributes"> |
||||
|
<attribute name="groups"> |
||||
|
stock.group_adv_location,stock.group_stock_multi_warehouses,user_warehouse_restriction.user_warehouse_restriction_group_user |
||||
|
</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//notebook/page[@name='warehouse_config']" |
||||
|
position="attributes"> |
||||
|
<attribute name="groups"> |
||||
|
stock.group_adv_location,stock.group_stock_multi_warehouses |
||||
|
</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//notebook" position="inside"> |
||||
|
<page string="Warehouse Allowed users" |
||||
|
name="allowed_users" colspan="4"> |
||||
|
<group colspan="4"> |
||||
|
<field name="user_ids" widget="many2many_tags"/> |
||||
|
<field name="restrict_location"/> |
||||
|
</group> |
||||
|
<button string="Restrict location for User" |
||||
|
class="btn btn-link" |
||||
|
invisible="restrict_location == False" |
||||
|
icon="fa-arrow-right" |
||||
|
type="object" name="action_open_users_view"/> |
||||
|
</page> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |