Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
944 Widoki

Unable to disable the Paid option for Users in the drop down menu. I want to edit the xml to have the Paid button visible only to the PoS Administrator. To find this option you login to the PoS App and click on the hamburger icon at the top right corner of the screen next to the WiFi icon. You then select Orders, the Paid button is part of the drop down menu items available after clicking on the "All active orders" button next to the search input field.

Awatar
Odrzuć
Autor

@Cybrosys I am using odoo online and i wasn't able to implement your solution to know if it would work. Not a developer so can you let me know what other method is available to enable this feature. Is it possible to edit the views or templates?

Autor

I would like to know the QWeb template that generates the view.

Najlepsza odpowiedź

Dear Solo Obiri,

Go to Settings > Security > Groups.

Create a new group (e.g., "Group: PoS Cashier") if you don't have one for non-administrator users.

Edit the existing "Point of Sale Administrator" group.

Under the "Point of Sale" access rights, uncheck the box for "Validate Order (Payment)".


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,


To show or hide the 'Paid' option based on user group, follow these steps:


1. Import the necessary modules:


import { SearchBar } from "@point_of_sale/app/screens/ticket_screen/search_bar/search_bar";

import { useService } from "@web/core/utils/hooks";

import { patch } from "@web/core/utils/patch";

import { onWillStart } from "@odoo/owl";


2. Patch the SearchBar prototype to modify its setup method:


patch(SearchBar.prototype, {

setup(_defaultObj, options) {

super.setup(...arguments);

this.user = useService("user");

onWillStart(async () => {

this.isPosManager = await this.user.hasGroup('point_of_sale.group_pos_manager');

if (!this.isPosManager) {

this.filterOptionsList = this.filterOptionsList.filter(option => option !== 'SYNCED');

}

})

},

})


3. Ensure to add the JavaScript file to the manifest under 'assets':


"assets": {

    "point_of_sale._assets_pos": ["path"]

}

Replace "path" with the actual path to your JavaScript file.


Hope it helps

Awatar
Odrzuć