employee.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # -*- coding: utf-8 -*-
  2. import base64
  3. import logging
  4. from odoo import api, fields, models
  5. from odoo.modules.module import get_module_resource
  6. from odoo import tools, _
  7. _logger = logging.getLogger(__name__)
  8. GENDER = [
  9. ('male', '男'),
  10. ('female', '女'),
  11. ('other', '其他')
  12. ]
  13. MARITAL = [
  14. ('single', '单身'),
  15. ('married', '已婚'),
  16. ('cohabitant', '合法同居'),
  17. ('widower', '丧偶'),
  18. ('divorced', '离婚')
  19. ]
  20. class Employee(models.Model):
  21. _name = 'ml.employee'
  22. _description = '''员工信息'''
  23. name = fields.Char(string='姓名')
  24. company_id = fields.Many2one('res.company', string='公司')
  25. gender = fields.Selection(GENDER, string='性别')
  26. country_id = fields.Many2one('res.country', string='国籍')
  27. birthday = fields.Date(string='生日')
  28. marital = fields.Selection(MARITAL, string='婚姻状况', default='single')
  29. address = fields.Char(string='家庭住址')
  30. mobile_phone = fields.Char(string='手机号')
  31. work_email = fields.Char(string='工作邮箱')
  32. leader_id = fields.Many2one('ml.employee', string='所属上级')
  33. subordinate_ids = fields.One2many('ml.employee', 'leader_id', string='下属')
  34. note = fields.Text(string='备注信息')