Odoo Help


How to exclude subcategories from POS category filtering?

Kevin Shenk
on 4/26/13, 12:29 PM 2,385 views

I'd like the POS to show only products from the current category, not subcategories. The reason is because we are selling made-to-order food products, and I'd like to use subcategories to create a succession of selections at checkout: first sandwich type, then bread type, then meat type, then cheese type, etc, with each selection represented by a separate subcategory.

I'm not very good at programming, but I think I've traced the fuction in question down to get_product_by_category in the db.js file.

Here's the code:

get_product_by_category: function(category_id){
    var product_ids  = this.product_by_category_id[category_id];
    var list = [];
    if (product_ids) {
        for (var i = 0, len = Math.min(product_ids.length, this.limit); i < len; i++) {
    return list;

I'm not sure how to alter this to show only products from the currently selected POS category, excluding products from sub-categories. Any help would be appreciated!

Kevin Shenk
On 4/26/13, 2:05 PM

OK, I figured this out.

Change line 179 in db.js from this:

            var ancestors = this.get_category_ancestors_ids(categ_id) || [];

To this:

            var ancestors = [];

I'd love to have this added as a configurable option in the future!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 4/26/13, 12:29 PM
Seen: 2385 times
Last updated: 3/16/15, 8:10 AM