Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3677 Visualizzazioni

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.

Avatar
Abbandona
Autore Risposta migliore

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

Avatar
Abbandona
Risposta migliore

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)
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
dic 22
8245
1
mar 19
18859
3
feb 20
10018
3
dic 19
6075
1
nov 24
1663