跳至内容
菜单
此问题已终结
1229 查看

Unable to disable the Paid option for Users in the drop down menu. I want  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.


I tried importing a module to custom the PoS App 

The file structure looks like this

custom_pos/

├── __init__.py

├── __manifest__.py

├── static/

│   └── src/

│       └── js/

│           └── pos_custom.js

└── views/

    └── pos_templates.xml


The manifest.py code looks like this

{

    'name': 'Custom POS',

    'version': '1.0',

    'category': 'Point of Sale',

    'summary': 'Customizations for POS',

    'description': 'This module customizes the POS filter options',

    'author': 'Your Name',

    'depends': ['point_of_sale'],

    'data': [

            'views/pos_templates.xml',

            ],

    'assets': {

        'point_of_sale.assets': [

            'custom_pos/static/src/js/pos_custom.js',

        ],

    },

    'qweb': [],

    'installable': True,

    'application': False,

    'auto_install': False,

}


The Javascript file looks like this

/** @odoo-module **/


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

import { OrderScreen } from "point_of_sale.OrderScreen";

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


patch(OrderScreen.prototype, 'custom_pos.HideFilterOptions', {

    setup() {

        this._super();

        this.userService = useService("user");


        this.userService.hasGroup('point_of_sale.group_pos_manager').then(isPosManager => {

            if (!isPosManager) {

                // Hide the filter options dropdown

                this.filterOptionsList = [];  // This clears the options list


                // Ensure any existing dropdown is hidden

                document.addEventListener('DOMContentLoaded', () => {

                    const filterDropdowns = document.querySelectorAll('.filter.dropdown-toggle');

                    filterDropdowns.forEach(filterDropdown => {

                        filterDropdown.style.display = 'none';

                    });

                });

            }

        });

    },

});


And the views/pos_temmplates.xml file looks like this

  

   

       

           

       

   


But when i try installing the module i get this error


Invalid Operation 

Error while importing module 'custom_pos'. while parsing None:3, somewhere inside

Any help?

形象
丢弃