You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
593 B

from openerp import models, fields,api
class RepEmployee(models.Model):
_inherit = 'hr.employee'
rep = fields.Boolean('Medical Representative')
commission = fields.Float('Commission')
target = fields.Integer('Target')
@api.one
def _get_total_sale(self):
total = 0.0
for EACH_Doctor in self.env['res.partner'].search([('doctor', '=', True)]):
if EACH_Doctor.related_rep.id == self.id:
total += EACH_Doctor.total_sale
self.total_sale = total
total_sale = fields.Integer('Total sale', compute='_get_total_sale')