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

I want to change the value of limit in ir_needaction_count?

By
James
on 11/10/16, 4:15 AM 119 views

Hi everyone:

   In V8 :

==================================================================================

def _needaction_count(self, cr, uid, domain=None, context=None):

""" Get the number of actions uid has to perform. """

dom = self._needaction_domain_get(cr, uid, context=context)

if not dom: return 0 res = self.search(cr, uid, (domain or []) + dom,limit=100, order='id DESC', context=context)

return len(res)

==============================================================================================


I would like to rewrite this function, remove the limit of count, but the model is osv.AbstractModel, I do not know how to rewrite this method, please help me!

thank you.

0
James
On 11/10/16, 8:54 PM

Thanks for your reply, I tried it, it didn't work.

0
fasluca
On 11/10/16, 6:13 AM

Inherit the class and override the function

class ir_needaction_mixin(osv.AbstractModel):
    _inherit = 'ir.needaction_mixin'
    def _needaction_count(self, cr, uid, domain=None, context=None):
    """ Get the number of actions uid has to perform. """
        dom = self._needaction_domain_get(cr, uid, context=context
        if not dom:
       return 0
        res = self.search(cr, uid, (domain or []) + dom, order='id DESC', context=context)
        return len(res)

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

1 follower(s)

Stats

Asked: 11/10/16, 4:15 AM
Seen: 119 times
Last updated: 11/10/16, 8:54 PM