res_partner.py 485 B

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