Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
2236 มุมมอง

By default, odoo V17 POS products shown are 100. i want limit to 10.



this code is working V13. not Working V17. anyone know how to make it working V17.


odoo.define("pos_search_limit.db", function(require) {

    "use strict";

    var PosDB = require("point_of_sale.DB");

    PosDB.include({

        limit: 10, // The maximum number of results returned by a search

    });

}); 



thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Try this code,
/** @odoo-module */

import { patch } from "@web/core/utils/patch";
import { PosDB } from "@point_of_sale/app/store/db";

patch(PosDB.prototype, {
});


Hope it helps

อวตาร
ละทิ้ง
ผู้เขียน

hi, i still not able to limit the pos product from 100 to 10.
can you write more detail code.
thanks

คำตอบที่ดีที่สุด

To ensure that your JavaScript customization is properly referenced and included in the Point of Sale (POS) module in Odoo,Check File Structure: Ensure your JavaScript file is located in the correct directory
  In Odoo 17, the structure for JavaScript customization has been changed like this 

import { useListener } from "@web/core";

import { PosDB } from "point_of_sale.DB";


useListener('pos_search_limit', () => {

    PosDB.include({

        _search: function(query, options){

            options = options || {};

            options.limit = 10; // Set the limit to 10

            return this._super(query, options);

        },

    });

});


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

You have to update your code according odoo 17 code structure, please check pos module from enterprise for reference.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มิ.ย. 25
639
Payment methods in POS V17 แก้ไขแล้ว
2
ก.ค. 25
1975
1
ม.ค. 25
2083
2
ต.ค. 24
2825
1
มี.ค. 24
1938