Skip to content
Open
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
105 changes: 105 additions & 0 deletions pos_user_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==============================
Point of Sale - Restrict users
==============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a649088e7d710b708f47d708db73c717872871b9fbc7087a4031803b91f046c8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/16.0/pos_user_restriction
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_user_restriction
: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/pos&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Restrict some users to only access their assigned points of sale.

**Table of contents**

.. contents::
:local:

Configuration
=============

With a POS Manager, open a point of sale configration (pos.config) and set "Assigned users" field.

Then, assign "User: Assigned POS Only" group to users who should be able to access to their assigned points of sale only.

Allowed Employees
Then assign "Authorized Employees" employee the same user "Assigned POS Only" Use employee credentials to log in to the PoS session and switch cashier.

Known issues / Roadmap
======================

This module alone is not compatible with pos_cache; you need to install a bridge module like https://github.com/OCA/pos/tree/12.0/pos_cache_user_restriction for it to work.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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/pos/issues/new?body=module:%20pos_user_restriction%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.

Credits
=======

Authors
~~~~~~~

* TAKOBI

Contributors
~~~~~~~~~~~~

* Lorenzo Battistini (https://takobi.online)
* Helly kapatel <helly.kapatel@initos.com>
* Imanol Aranburu <iaranburu@binovo.es>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-eLBati| image:: https://github.com/eLBati.png?size=40px
:target: https://github.com/eLBati
:alt: eLBati

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-eLBati|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions pos_user_restriction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions pos_user_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2020 Lorenzo Battistini @ TAKOBI
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Point of Sale - Restrict users",
"summary": "Restrict some users to see and use only certain points of sale",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Point of Sale",
"website": "https://github.com/OCA/pos",
"author": "TAKOBI, Odoo Community Association (OCA)",
"maintainers": ["eLBati"],
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"point_of_sale",
],
"data": [
"security/pos_security.xml",
"security/ir.model.access.csv",
"views/pos_config_views.xml",
"views/point_of_sale_views.xml",
],
}
89 changes: 89 additions & 0 deletions pos_user_restriction/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_user_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-29 13:40+0000\n"
"PO-Revision-Date: 2026-04-29 13:40+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: pos_user_restriction
#: model:ir.model.fields,field_description:pos_user_restriction.field_pos_config__assigned_user_ids
msgid "Assigned users"
msgstr "Usuarios asignados"

#. module: pos_user_restriction
#: model:ir.model,name:pos_user_restriction.model_pos_config
msgid "Point of Sale Configuration"
msgstr "Configuración del TPV"

#. module: pos_user_restriction
#: model:ir.model,name:pos_user_restriction.model_pos_session
msgid "Point of Sale Session"
msgstr "Sesión TPV"

#. module: pos_user_restriction
#: model:ir.model.fields,field_description:pos_user_restriction.field_pos_config__group_pos_user_id
msgid "Point of Sale User Group"
msgstr "Grupo de usuario del punto de venta"

#. module: pos_user_restriction
#: model_terms:ir.ui.view,arch_db:pos_user_restriction.pos_config_view_form_users
msgid ""
"Restrict some users to only access their assigned points of sale. In order "
"to apply the restriction, the user needs the 'User: Assigned POS Only' group"
msgstr ""
"Restringir el acceso de algunos usuarios únicamente a sus puntos de venta asignados. "
"Para aplicar esta restricción, el usuario debe pertenecer al grupo 'Usuario: Solo TPV asignado'"

#. module: pos_user_restriction
#: model:ir.model.fields,help:pos_user_restriction.field_pos_config__assigned_user_ids
msgid ""
"Restrict some users to only access their assigned points of sale.In order to"
" apply the restriction, the user needs the 'User: Assigned POS Only' group"
msgstr ""
"Restringir el acceso de algunos usuarios únicamente a sus puntos de venta asignados. "
"Para aplicar esta restricción, el usuario debe pertenecer al grupo 'Usuario: Solo TPV asignado'"

#. module: pos_user_restriction
#: model:res.groups,comment:pos_user_restriction.group_assigned_points_of_sale_user
msgid "The user will have access to her assigned points of sale."
msgstr "El usuario tendrá acceso a los puntos de venta que le hayan sido asignados."

#. module: pos_user_restriction
#: model:ir.model.fields,help:pos_user_restriction.field_pos_config__group_pos_user_id
msgid ""
"This field is there to passthe id of the pos user group to the point of sale"
" client."
msgstr ""
"Este campo se encuentra aquí para pasar el identificador del grupo de "
"usuarios del punto de venta al cliente del punto de venta."

#. module: pos_user_restriction
#: model:ir.model,name:pos_user_restriction.model_res_users
msgid "User"
msgstr "Usuario"

#. module: pos_user_restriction
#: model:res.groups,name:pos_user_restriction.group_assigned_points_of_sale_user
msgid "User: Assigned POS Only"
msgstr "Usuario: Solo TPV asignado"

#. module: pos_user_restriction
#: model_terms:ir.ui.view,arch_db:pos_user_restriction.pos_config_view_form_users
msgid "Users"
msgstr "Usuarios"

#. module: pos_user_restriction
#: model_terms:ir.ui.view,arch_db:pos_user_restriction.pos_config_view_form_users
msgid "Users assigned to this point of sale"
msgstr "Usuarios asignados a este punto de venta"

3 changes: 3 additions & 0 deletions pos_user_restriction/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import pos_config
from . import pos_session
from . import res_users
29 changes: 29 additions & 0 deletions pos_user_restriction/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from odoo import api, fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

assigned_user_ids = fields.Many2many(
"res.users",
string="Assigned users",
help="Restrict some users to only access their assigned points of sale."
"In order to apply the restriction, the user needs the "
"'User: Assigned POS Only' group",
)
group_pos_user_id = fields.Many2one(
"res.groups",
compute="_compute_group_pos_user_id",
string="Point of Sale User Group",
help="This field is there to pass"
"the id of the pos user group to the point of sale client.",
store=True,
)

@api.depends("assigned_user_ids")
def _compute_group_pos_user_id(self):
for config in self:
config.group_pos_user_id = self.env.ref(
"pos_user_restriction.group_assigned_points_of_sale_user",
"point_of_sale.group_pos_user",
)
19 changes: 19 additions & 0 deletions pos_user_restriction/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def set_cashbox_pos(self, cashbox_value, notes):
if self.env.user.has_group(
"pos_user_restriction.group_assigned_points_of_sale_user"
):
self = self.with_context(bypass_pos_user=True)
return super().set_cashbox_pos(cashbox_value, notes)

def get_closing_control_data(self):
if self.env.user.has_group(
"pos_user_restriction.group_assigned_points_of_sale_user"
):
self = self.with_context(bypass_pos_user=True)
return super().get_closing_control_data()
24 changes: 24 additions & 0 deletions pos_user_restriction/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from odoo import api, models
from odoo.tools import ormcache


class ResUsers(models.Model):
_inherit = "res.users"

@api.model
def has_group(self, group_ext_id):
if group_ext_id == "point_of_sale.group_pos_user" and self.env.context.get(
"bypass_pos_user"
):
return True
else:
res = super().has_group(group_ext_id)
return res

# HACK: To clear cache called from res.users write method
@api.model
@ormcache("self._uid", "group_ext_id")
def _has_group(self, group_ext_id):
return super()._has_group(group_ext_id)

has_group.clear_cache = _has_group.clear_cache
6 changes: 6 additions & 0 deletions pos_user_restriction/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
With a POS Manager, open a point of sale configration (pos.config) and set "Assigned users" field.

Then, assign "User: Assigned POS Only" group to users who should be able to access to their assigned points of sale only.

Allowed Employees
Then assign "Authorized Employees" employee the same user "Assigned POS Only" Use employee credentials to log in to the PoS session and switch cashier.
3 changes: 3 additions & 0 deletions pos_user_restriction/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Lorenzo Battistini (https://takobi.online)
* Helly kapatel <helly.kapatel@initos.com>
* Imanol Aranburu <iaranburu@binovo.es>
1 change: 1 addition & 0 deletions pos_user_restriction/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restrict some users to only access their assigned points of sale.
1 change: 1 addition & 0 deletions pos_user_restriction/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module alone is not compatible with pos_cache; you need to install a bridge module like https://github.com/OCA/pos/tree/12.0/pos_cache_user_restriction for it to work.
28 changes: 28 additions & 0 deletions pos_user_restriction/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_pos_order,pos.order,point_of_sale.model_pos_order,group_assigned_points_of_sale_user,1,1,1,1
access_pos_order_line,pos.order.line,point_of_sale.model_pos_order_line,group_assigned_points_of_sale_user,1,1,1,1
access_pos_pack_operation_lot,pos.pack.operation.lot,point_of_sale.model_pos_pack_operation_lot,group_assigned_points_of_sale_user,1,1,1,1
access_stock_picking_pos_user,stock.picking pos_user,stock.model_stock_picking,group_assigned_points_of_sale_user,1,1,1,1
access_stock_warehouse_pos_user,stock.warehouse pos_user,stock.model_stock_warehouse,group_assigned_points_of_sale_user,1,0,0,0
access_stock_move_pos_user,stock.move pos_user,stock.model_stock_move,group_assigned_points_of_sale_user,1,1,1,1
access_report_pos_order,report.pos.order,point_of_sale.model_report_pos_order,group_assigned_points_of_sale_user,1,1,1,1
access_account_journal_pos_user,account.journal pos_user,account.model_account_journal,group_assigned_points_of_sale_user,1,0,0,0
access_account_payment_method_pos_user,account.payment.method pos_user,account.model_account_payment_method,group_assigned_points_of_sale_user,1,0,0,0
access_account_bank_statement,account.bank.statement,account.model_account_bank_statement,group_assigned_points_of_sale_user,1,1,1,0
access_account_bank_statement_line,account.bank.statement.line,account.model_account_bank_statement_line,group_assigned_points_of_sale_user,1,1,1,0
access_product_product,product.product,product.model_product_product,group_assigned_points_of_sale_user,1,0,0,0
access_product_template_pos_user,product.template pos user,product.model_product_template,group_assigned_points_of_sale_user,1,0,0,0
access_product_product_supplierinfo_user,product.supplierinfo user,product.model_product_supplierinfo,group_assigned_points_of_sale_user,1,0,0,0
access_product_product_packaging_user,product.packaging user,product.model_product_packaging,group_assigned_points_of_sale_user,1,0,0,0
access_product_pricelist_user,product.pricelist user,product.model_product_pricelist,group_assigned_points_of_sale_user,1,0,0,0
access_pos_session_user,pos.session user,point_of_sale.model_pos_session,group_assigned_points_of_sale_user,1,1,1,0
access_pos_config_user,pos.config user,point_of_sale.model_pos_config,group_assigned_points_of_sale_user,1,1,0,0
access_product_category_pos_user,pos.category user,point_of_sale.model_pos_category,group_assigned_points_of_sale_user,1,0,0,0
access_barcode_nomenclature_pos_user,barcode.nomenclature.pos.user,barcodes.model_barcode_nomenclature,group_assigned_points_of_sale_user,1,0,0,0
access_barcode_rule_pos_user,barcode.rule.pos.user,barcodes.model_barcode_rule,group_assigned_points_of_sale_user,1,0,0,0
access_account_cash_rounding_pos_user,account.cash.rounding.pos.user,account.model_account_cash_rounding,group_assigned_points_of_sale_user,1,0,0,0
access_pos_payment_method_user,pos.payment.method user,point_of_sale.model_pos_payment_method,group_assigned_points_of_sale_user,1,0,0,0
access_decimal_precision_user,decimal.precision,base.model_decimal_precision,group_assigned_points_of_sale_user,1,0,0,0
access_pos_payment_user,pos.payment user,point_of_sale.model_pos_payment,group_assigned_points_of_sale_user,1,1,1,1
access_pos_bill_user,pos.bill,point_of_sale.model_pos_bill,group_assigned_points_of_sale_user,1,1,1,1
access_pos_close_session_wizard,access.pos.close.session.wizard,point_of_sale.model_pos_close_session_wizard,group_assigned_points_of_sale_user,1,1,1,0
Loading
Loading