/** @odoo-module **/

import { patch } from "@web/core/utils/patch";
import { PartnerList } from "@point_of_sale/app/screens/partner_list/partner_list";
import { useService } from "@web/core/utils/hooks";
import { onWillStart, useState } from "@odoo/owl";

patch(PartnerList.prototype, {
    setup() {
        super.setup(...arguments);

        this.orm = useService("orm");

        this.hideState = useState({ hideCreateCustomerBtn: false });

        onWillStart(async () => {
            this.hideState.hideCreateCustomerBtn = await this.orm.call(
                "res.users",
                "check_hide_pos_create_customer",
                []
            );
        });
    },
});
