-
-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] pos_cash_control_override: New module
TT51987
- Loading branch information
1 parent
85f82d4
commit f931a43
Showing
16 changed files
with
663 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
=================================== | ||
Point of sale cash control override | ||
=================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:56d19ad35a758bf8f5dbbc2b81f7cd13423c513262350bde69fb801b32e8313b | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-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_cash_control_override | ||
: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_cash_control_override | ||
: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| | ||
|
||
This module restores the permissions requisites for Point of Sale users | ||
to perform cash operations in their sessions. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Use Cases / Context | ||
=================== | ||
|
||
From `this change <https://github.com/odoo/odoo/pull/130275>`__ a Point | ||
of Sale user who needs to perform cash control operations | ||
*Accounting/Billing* permission is required. That's a huge permission | ||
for the kind of user that only does cashing machine operations. | ||
|
||
We're recovering the former behavior present in previous versions. | ||
|
||
Usage | ||
===== | ||
|
||
After this module is installed: | ||
|
||
1. Choose a user with all the permissions execpt *Point of Sale/User*. | ||
2. Open a session in a Point of Sale with cash control active. | ||
3. You'll be able to do any the cash control operations (cash in / out). | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
- This module will be unnecessary if | ||
https://github.com/odoo/odoo/pull/188798 gets merged or the former | ||
permissions paradigm is restored in any other way. | ||
|
||
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_cash_control_override%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 | ||
------- | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
------------ | ||
|
||
- `Tecnativa <https://tecnativa.com>`__ | ||
|
||
- David Vidal | ||
|
||
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. | ||
|
||
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_cash_control_override>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
from . import models |
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,15 @@ | ||
# Copyright 2024 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Point of sale cash control override", | ||
"summary": "Override bare PoS user cash control restrictions", | ||
"version": "16.0.1.0.0", | ||
"category": "Point of Sale", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"point_of_sale", | ||
], | ||
"data": [], | ||
} |
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,2 @@ | ||
from . import account_bank_statement_line | ||
from . import pos_session |
15 changes: 15 additions & 0 deletions
15
pos_cash_control_override/models/account_bank_statement_line.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,15 @@ | ||
# Copyright 2024 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import api, models | ||
|
||
|
||
class AccountBankStatementLine(models.Model): | ||
_inherit = "account.bank.statement.line" | ||
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
if self.env.context.get( | ||
"override_cash_control_permissions" | ||
) and self.user_has_groups("point_of_sale.group_pos_user"): | ||
self = self.sudo() | ||
return super().create(vals_list) | ||
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,17 @@ | ||
# Copyright 2024 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import models | ||
|
||
|
||
class PosSession(models.Model): | ||
_inherit = "pos.session" | ||
|
||
def try_cash_in_out(self, _type, amount, reason, extras): | ||
if not self.user_has_groups("account.group_account_invoice"): | ||
self = self.with_context(override_cash_control_permissions=True) | ||
return super().try_cash_in_out(_type, amount, reason, extras) | ||
|
||
def _get_pos_ui_pos_config(self, params): | ||
config = super()._get_pos_ui_pos_config(params) | ||
config["has_cash_move_permission"] = True | ||
return config | ||
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,5 @@ | ||
From [this change](https://github.com/odoo/odoo/pull/130275) a Point of Sale user | ||
who needs to perform cash control operations *Accounting/Billing* permission is required. | ||
That's a huge permission for the kind of user that only does cashing machine operations. | ||
|
||
We're recovering the former behavior present in previous versions. |
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,2 @@ | ||
- [Tecnativa](https://tecnativa.com) | ||
- David Vidal |
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,2 @@ | ||
This module restores the permissions requisites for Point of Sale users to perform | ||
cash operations in their sessions. |
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,2 @@ | ||
- This module will be unnecessary if https://github.com/odoo/odoo/pull/188798 gets | ||
merged or the former permissions paradigm is restored in any other way. |
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,5 @@ | ||
After this module is installed: | ||
|
||
1. Choose a user with all the permissions execpt *Point of Sale/User*. | ||
2. Open a session in a Point of Sale with cash control active. | ||
3. You'll be able to do any the cash control operations (cash in / out). |
Oops, something went wrong.