Skip to content
Merged
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
4 changes: 4 additions & 0 deletions tg_pos/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

* Added user group "Point of Sale - Show +/- in payment screen"

* Added user group "Point of Sale - Show +/- in product screen"

* Added user group "Point of Sale - Show Refund button"

* Added user group "Point of Sale - Enable pricelist button".
If user belongs to this group, pricelist button will be enabled, otherwise disabled.

Expand Down
14 changes: 14 additions & 0 deletions tg_pos/models/pos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class PosConfig(models.Model):
comodel_name="res.groups",
compute="_compute_groups_tg",
)
group_show_pm_in_product_screen_id = fields.Many2one(
comodel_name="res.groups",
compute="_compute_groups_tg",
)
group_show_refund_button_id = fields.Many2one(
comodel_name="res.groups",
compute="_compute_groups_tg",
)
group_enable_pricelist_button_id = fields.Many2one(
comodel_name="res.groups",
compute="_compute_groups_tg",
Expand All @@ -42,6 +50,12 @@ def _compute_groups_tg(self):
"group_show_pm_in_payment_screen_id": self.env.ref(
"tg_pos.group_show_pm_in_payment_screen"
).id,
"group_show_pm_in_product_screen_id": self.env.ref(
"tg_pos.group_show_pm_in_product_screen"
).id,
"group_show_refund_button_id": self.env.ref(
"tg_pos.group_show_refund_button"
).id,
"group_enable_pricelist_button_id": self.env.ref(
"tg_pos.group_pos_enable_pricelist_button"
).id,
Expand Down
3 changes: 3 additions & 0 deletions tg_pos/models/pos_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def _get_pos_ui_res_users(self, params):
in groups,
hasGroupShowPMInPaymentScreen=config.group_show_pm_in_payment_screen_id # noqa: E501
in groups,
hasGroupShowPMInProductScreen=config.group_show_pm_in_product_screen_id # noqa: E501
in groups,
hasGroupShowRefundButton=config.group_show_refund_button_id in groups,
hasGroupEnablePricelistButton=config.group_enable_pricelist_button_id
in groups,
)
Expand Down
19 changes: 19 additions & 0 deletions tg_pos/security/point_of_sale_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>

<record id="group_show_pm_in_product_screen" model="res.groups">
<field name="name">Point of Sale - Show +/- in product screen</field>
<field name="category_id" ref="base.module_category_usability" />
<field
name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>

<record id="group_show_refund_button" model="res.groups">
<field name="name">Point of Sale - Show Refund Button</field>
<field name="category_id" ref="base.module_category_usability" />
<field
name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>

<record id="group_pos_enable_pricelist_button" model="res.groups">
<field name="name">Point of Sale - Enable pricelist button</field>
<field name="category_id" ref="base.module_category_usability" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">

<t
t-name="RefundButton"
t-inherit="point_of_sale.RefundButton"
t-inherit-mode="extension"
>
<xpath expr="//button" position="attributes">
<attribute
name="t-att-class"
>{disabled: !pos.user.hasGroupShowRefundButton}</attribute>
</xpath>
</t>

</templates>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @odoo-module */

import {ProductScreen} from "@point_of_sale/app/screens/product_screen/product_screen";
import {patch} from "@web/core/utils/patch";

patch(ProductScreen.prototype, {
getNumpadButtons() {
const r = super.getNumpadButtons();
return r.map((button) => {
if (button.value == "-" && !this.pos.user.hasGroupShowPMInProductScreen) {
button.class += " disabled";
}
return button;
});
},
});
Loading