Debian Codegraph @

addons/l10n_fr_pos_cert/static/src/app/services/pos.js

raw
1 import { PosStore } from "@point_of_sale/app/services/pos_store";
2 import { _t } from "@web/core/l10n/translation";
3 import { patch } from "@web/core/utils/patch";
4 import { AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
5
6 patch(PosStore.prototype, {
7 is_french_country() {
8 const french_countries = ["FR", "MF", "MQ", "NC", "PF", "RE", "GF", "GP", "TF"];
9 if (!this.company.country_id) {
10 this.dialog.add(AlertDialog, {
11 title: _t("Missing Country"),
12 body: _t("The company %s doesn't have a country set.", this.company.name),
13 });
14 return false;
15 }
16 return french_countries.includes(this.company.country_id?.code);
17 },
18 canEditPayment(order) {
19 return this.is_french_country() ? false : super.canEditPayment(order);
20 },
21 });