1
votes

I have created a function to export data of selected record to a csv file. For example I have opened the product tree view, there are so many filters, I have selected 'service products filter' showing 5 products, then I click on the action and then the export button in my export wizard, these 5 products shown in the tree view are exported to a csv file.

I have more than 4000 consumable products, if I select the filter consumable products, then the tree view will show 80 records(default limit) in the tree view. And if I click on the action and export the details, then I only get the 80 record IDs and these records are exported. But I need to get all consumable product IDs.

Is there any way to get all the ids that come under the active filter in the model?

3

3 Answers

1
votes

Apply your filter and change number of visible records to unlimited (press on the field [1 to 80] of 4000 which is on the right top corner of you product tree view).

1
votes

you can try our module for exporting to XLS. The good thing is that you can export the view as is meaning that you can set the limit filter to unlimited to get all the records. Also, you'll get all the values already formatted for displaying. Group stuff is purged ATM but I'm planning to add a proper support for that.

Moreover, regarding 'how to get all the ids' take a look at this question that is sadly unanswered.

0
votes

Try to override search method for that model and add search ids to the context -> active ids.

def search(self, cr, uid, args, offset=0, limit=None, order=None,context=None, count=False):
    product_ids = super(product_product, self).search(cr,uid,args=tuple_search, offset=offset, limit=limit, order=order,
        context=context, count=count)
    context.update('active_ids' : product_ids)
    return product_ids

Not sure but might it helps you.