diff --git a/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js b/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js index 7fd5dd78d36..3451c525379 100644 --- a/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js +++ b/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js @@ -3,7 +3,7 @@ import { _t } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; import { debounce } from "@web/core/utils/timing"; -import { useService } from "@web/core/utils/hooks"; +import { useService, useAutofocus } from "@web/core/utils/hooks"; import { useAsyncLockedMethod } from "@point_of_sale/app/utils/hooks"; import { session } from "@web/session"; @@ -37,6 +37,7 @@ export class PartnerListScreen extends Component { this.orm = useService("orm"); this.notification = useService("pos_notification"); this.searchWordInputRef = useRef("search-word-input-partner"); + useAutofocus({refName: 'search-word-input-partner'}); this.state = useState({ query: null, diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/product_screen.js b/addons/point_of_sale/static/src/app/screens/product_screen/product_screen.js index 38fe8467e76..5167103d1cd 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/product_screen.js +++ b/addons/point_of_sale/static/src/app/screens/product_screen/product_screen.js @@ -61,7 +61,9 @@ export class ProductScreen extends ControlButtonsMixin(Component) { // the callbacks in `onMounted` hook. onMounted(() => this.numberBuffer.reset()); this.numberBuffer.use({ - triggerAtInput: (...args) => this.updateSelectedOrderline(...args), + triggerAtInput: (...args) => { + if (!this.pos.tempScreenIsShown) this.updateSelectedOrderline(...args); + }, useWithBarcode: true, }); } diff --git a/addons/point_of_sale/static/src/app/store/pos_store.js b/addons/point_of_sale/static/src/app/store/pos_store.js index d4d3204252b..fd54e2d94a6 100644 --- a/addons/point_of_sale/static/src/app/store/pos_store.js +++ b/addons/point_of_sale/static/src/app/store/pos_store.js @@ -151,6 +151,7 @@ export class PosStore extends Reactive { this.ordersToUpdateSet = new Set(); // used to know which orders need to be sent to the back end when syncing this.loadingOrderState = false; // used to prevent orders fetched to be put in the update set during the reactive change this.showOfflineWarning = true; // Allows to avoid the display of the offline popup when the user has already had it. + this.tempScreenIsShown = false; // these dynamic attributes can be watched for change by other models or widgets Object.assign(this, { @@ -1944,10 +1945,12 @@ export class PosStore extends Reactive { component: registry.category("pos_screens").get(name), props: { ...props, resolve }, }; + this.tempScreenIsShown = true; }); } closeTempScreen() { + this.tempScreenIsShown = false; this.tempScreen = null; } openCashControl() {