for count records matching a domain you should use function "search_count", quote from documentation:
search_count(args) → int
Returns the number of records in the current model matching the provided domain.
in your case, it'll be something like,
in v8 style:
count = self.env['model.name.to.search.in'].search_count([('state','=','in')])
in v7 style:
count = self.pool['model.name.to.search.in'].search_count(cr,uid, [('state', '=', 'in')], context=context)
then in "count" variable you'll have the desired number. adapt it to your case.
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
|Asked: 8/24/15, 5:41 AM|
|Seen: 898 times|
|Last updated: 8/24/15, 10:55 AM|