Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] [mig] pos_user_restriction #649

Merged
merged 12 commits into from
Jun 24, 2021
Merged
88 changes: 88 additions & 0 deletions pos_user_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
==============================
Point of Sale - Restrict users
==============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/licence-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:/OCA/pos/tree/12.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-12-0/pos-12-0-pos_user_restriction
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/184/12.0
:alt: Try me on Runbot

|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.

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

Bugs are tracked on `GitHub Issues <https:/OCA/pos/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https:/OCA/pos/issues/new?body=module:%20pos_user_restriction%0Aversion:%2012.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)

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:/eLBati.png?size=40px
:target: https:/eLBati
:alt: eLBati

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

|maintainer-eLBati|

This module is part of the `OCA/pos <https:/OCA/pos/tree/12.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
22 changes: 22 additions & 0 deletions pos_user_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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": "14.0.1.0.0",
"development_status": "Beta",
"category": "Point of Sale",
"website": "https:/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",
],
}
56 changes: 56 additions & 0 deletions pos_user_restriction/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_user_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-07-27 11:19+0000\n"
"Last-Translator: Daniel Martinez Vila <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\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 punto de venta"

#. module: pos_user_restriction
#: model:ir.model.fields,help:pos_user_restriction.field_pos_config__assigned_user_ids
#: 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 ""
"Restrinja a algunos usuarios para que solo accedan a sus puntos de venta "
"asignados. Para aplicar la restricción, el usuario necesita el grupo "
"'Usuario: PdV asignado solo'"

#. 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 sus puntos de venta asignados."

#. 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 PdV 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"
58 changes: 58 additions & 0 deletions pos_user_restriction/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_user_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-07 04:49+0000\n"
"PO-Revision-Date: 2020-07-07 04:49+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \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 "Utenti assegnati"

#. module: pos_user_restriction
#: model:ir.model,name:pos_user_restriction.model_pos_config
msgid "Point of Sale Configuration"
msgstr "Configurazione punto vendita"

#. module: pos_user_restriction
#: model:ir.model.fields,help:pos_user_restriction.field_pos_config__assigned_user_ids
#: 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 ""
"Limitare alcuni utenti ad accedere solamente ai loro punti vendita "
"assegnati. Per applicare la restrizione, l'utente necessita il gruppo "
"'Utente: solamente POS assegnati'"

#. 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 "L'utente avrà accesso ai propri punti vendita assegnati."

#. module: pos_user_restriction
#: model:res.groups,name:pos_user_restriction.group_assigned_points_of_sale_user
msgid "User: Assigned POS Only"
msgstr "Utente: solamente POS assegnati"

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

#. 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 "Utenti assegnati a questo punto vendita"
51 changes: 51 additions & 0 deletions pos_user_restriction/i18n/pos_user_restriction.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_user_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \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 ""

#. module: pos_user_restriction
#: model:ir.model,name:pos_user_restriction.model_pos_config
msgid "Point of Sale Configuration"
msgstr ""

#. module: pos_user_restriction
#: model:ir.model.fields,help:pos_user_restriction.field_pos_config__assigned_user_ids
#: 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 ""

#. 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 ""

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

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

#. 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 ""

1 change: 1 addition & 0 deletions pos_user_restriction/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import pos_config
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",
)
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.
2 changes: 2 additions & 0 deletions pos_user_restriction/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Lorenzo Battistini (https://takobi.online)
* Helly kapatel <[email protected]>
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.
29 changes: 29 additions & 0 deletions pos_user_restriction/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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_bank_statement_cashbox_user,account.bank.statement.cashbox user,account.model_account_bank_statement_cashbox,group_assigned_points_of_sale_user,1,1,1,0
access_account_cashbox_line_user,account.cashbox.line user,account.model_account_cashbox_line,group_assigned_points_of_sale_user,1,1,1,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_money_in_out_wizard,access.money.in.out.wizard,point_of_sale.model_cash_box_out,group_assigned_points_of_sale_user,1,1,1,0
access_pos_payment_user,pos.payment user,point_of_sale.model_pos_payment,group_assigned_points_of_sale_user,1,1,1,1
Loading