# -*- coding: utf-8 -*- # ,('customer', operator, 'true') ############################################################################## , ('type', '=', 'receipt') # import web_pdb; from openerp.osv import fields,osv class res_partner(osv.osv): _inherit = 'res.partner' def _voucher_count_customer(self, cr, uid, ids, field_name, arg, context=None): res = dict(map(lambda x: (x,0), ids)) try: for partner in self.browse(cr, uid, ids, context): operator = '=' voucher_ids = self.pool['account.voucher'].search(cr, uid, [('partner_id', operator, partner.id)], context=context) res[partner.id] = len(partner.voucher_ids) except: pass return res _columns = { 'voucher_ids': fields.one2many('account.voucher', 'partner_id',\ 'Cobros/Pagos'), 'voucher_count_customer': fields.function(_voucher_count_customer, string='# de Cobros/Pagos', type='integer') } # web_pdb.set_trace()