res_partner.py 440 B

12345678910111213
  1. # -*- encoding: utf-8 -*-
  2. from openerp import models, fields, api, _
  3. class res_partner(models.Model):
  4. _inherit = 'res.partner'
  5. appointment_count = fields.Integer(compute='_appointment_count', string='Consultas')
  6. @api.one
  7. def _appointment_count(self):
  8. appointment = self.env['sis.stock.transfer'].search([('partner_id', '=', self.id),('type','=','appointment')])
  9. self.appointment_count = len(appointment)