Odoo Help

Welcome!

This community 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.

0

How to exclude subcategories from POS category filtering?

By
Kevin Shenk
on 4/26/13, 12:29 PM 1,798 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++) {
            list.push(this.product_by_id[product_ids[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!

0
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!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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