Skip to content

Commit

Permalink
[MIG] pos_access_right: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
geomer198 authored and ivs-cetmix committed Sep 26, 2023
1 parent cfe5699 commit d1774b9
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 95 deletions.
8 changes: 4 additions & 4 deletions pos_access_right/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ Point of Sale - Extra Access Right
: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/14.0/pos_access_right
:target: https://github.com/OCA/pos/tree/16.0/pos_access_right
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_access_right
: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/14.0
:target: https://runbot.odoo-community.org/runbot/184/16.0
:alt: Try me on Runbot

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

This module extends Odoo Point Of Sale features, restricting possibility to cashier to make some actions in the Point of Sale. This module will add the following groups to Odoo:

Expand Down Expand Up @@ -89,6 +89,6 @@ 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/14.0/pos_access_right>`_ project on GitHub.
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_access_right>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
12 changes: 8 additions & 4 deletions pos_access_right/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": ["point_of_sale"],
"demo": ["demo/res_groups.xml"],
"data": [
"security/res_groups.xml",
"views/templates.xml",
],
"demo": [
"demo/res_groups.xml",
],
"assets": {
"point_of_sale.assets": [
"pos_access_right/static/src/css/*",
"pos_access_right/static/src/js/*.js",
"pos_access_right/static/src/xml/*.xml",
]
},
"qweb": [
"static/src/xml/*.xml",
],
Expand Down
2 changes: 1 addition & 1 deletion pos_access_right/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-09 22:22+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
Expand Down
2 changes: 1 addition & 1 deletion pos_access_right/i18n/pos_access_right.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
1 change: 1 addition & 0 deletions pos_access_right/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import pos_config
from . import pos_session
22 changes: 22 additions & 0 deletions pos_access_right/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from odoo import models


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

def _get_pos_ui_res_users(self, params):
user_vals = super()._get_pos_ui_res_users(params)
user_id = user_vals.get("id")
if user_id:
user = self.env["res.users"].browse(user_id)
groups = user.groups_id
config = self.config_id
user_vals.update(
hasGroupPayment=config.group_payment_id in groups,
hasGroupDiscount=config.group_discount_id in groups,
hasGroupNegativeQty=config.group_negative_qty_id in groups,
hasGroupPriceControl=config.group_change_unit_price_id in groups,
hasGroupMultiOrder=config.group_multi_order_id in groups,
hasGroupDeleteOrder=config.group_delete_order_id in groups,
)
return user_vals
4 changes: 2 additions & 2 deletions pos_access_right/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Point of Sale - Extra Access Right</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/pos/tree/14.0/pos_access_right"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_access_right"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/184/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/pos/tree/16.0/pos_access_right"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_access_right"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/184/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends Odoo Point Of Sale features, restricting possibility to cashier to make some actions in the Point of Sale. This module will add the following groups to Odoo:</p>
<ul class="simple">
<li><strong>PoS - Negative Quantity</strong>: The cashier can sell negative quantity in Point Of Sale (ie, can return products);</li>
Expand Down Expand Up @@ -430,7 +430,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/14.0/pos_access_right">OCA/pos</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/16.0/pos_access_right">OCA/pos</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion pos_access_right/static/src/js/ActionpadWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ odoo.define("pos_access_right.ActionpadWidget", function (require) {
const PosActionpadWidget = (ActionpadWidget) =>
class extends ActionpadWidget {
get hasPaymentControlRights() {
return this.env.pos.get_cashier().hasGroupPayment;
return this.env.pos.user.hasGroupPayment;
}
};

Expand Down
15 changes: 3 additions & 12 deletions pos_access_right/static/src/js/NumpadWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,17 @@ odoo.define("pos_access_right.NumpadWidget", function (require) {
get hasManualDiscount() {
const res = super.hasManualDiscount;
if (res) {
if (this.env.pos.get_cashier().hasGroupDiscount) {
return true;
}
return false;
return this.env.pos.user.hasGroupDiscount;
}
return res;
}
get hasMinusControlRights() {
if (this.env.pos.get_cashier().hasGroupNegativeQty) {
return true;
}
return false;
return this.env.pos.user.hasGroupNegativeQty;
}
get hasPriceControlRights() {
const res = super.hasPriceControlRights;
if (res) {
if (this.env.pos.get_cashier().hasGroupPriceControl) {
return true;
}
return false;
return this.env.pos.user.hasGroupPriceControl;
}
return res;
}
Expand Down
7 changes: 2 additions & 5 deletions pos_access_right/static/src/js/TicketScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ odoo.define("pos_access_right.TicketScreen", function (require) {
const PosTicketScreen = (TicketScreen) =>
class extends TicketScreen {
get hasNewOrdersControlRights() {
if (this.env.pos.get_cashier().hasGroupMultiOrder) {
return true;
}
return false;
return this.env.pos.user.hasGroupMultiOrder;
}

async deleteOrder(order) {
if (this.env.pos.get_cashier().hasGroupDeleteOrder) {
if (this.env.pos.user.hasGroupDeleteOrder) {
return super.deleteOrder(order);
}
return false;
Expand Down
40 changes: 0 additions & 40 deletions pos_access_right/static/src/js/models.js

This file was deleted.

4 changes: 2 additions & 2 deletions pos_access_right/tests/test_pos_access_right.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from odoo.tests.common import SavepointCase
from odoo.tests import TransactionCase


class TestUserRestriction(SavepointCase):
class TestUserRestriction(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down
23 changes: 0 additions & 23 deletions pos_access_right/views/templates.xml

This file was deleted.

0 comments on commit d1774b9

Please sign in to comment.