132 lines
4.1 KiB
Python
132 lines
4.1 KiB
Python
from odoo import models, fields
|
|
|
|
_stats_list = [("dang_lam", "Đang làm"), ("da_nghi", "Đã nghỉ")]
|
|
_gender_list = [("male", "Nam"), ("female", "Nữ"), ("other", "Khác")]
|
|
from .models_constants import Common
|
|
|
|
|
|
class CenhomesGiaoVienChuNhiem(models.Model):
|
|
_name = "cenhomes.giao_vien_chu_nhiem"
|
|
_description = "Giáo viên chủ nhiệm"
|
|
|
|
name = fields.Char(string="Tên", required=True)
|
|
ngay_sinh = fields.Date(string="Ngày sinh")
|
|
gioi_tinh = fields.Selection(string="Giới tính", selection=_gender_list)
|
|
ngay_gia_nhap = fields.Date(string="Ngày gia nhập")
|
|
trang_thai = fields.Selection(
|
|
string="Trạng thái", selection=_stats_list, default="dang_lam"
|
|
)
|
|
|
|
def name_get(self):
|
|
return [(record.id, record.name) for record in self]
|
|
|
|
def write(self, vals):
|
|
return super().write(vals)
|
|
|
|
|
|
class CenhomesGiaoVienDayTieng(models.Model):
|
|
_name = "cenhomes.giao_vien_day_tieng"
|
|
_description = "Giáo viên dạy tiếng"
|
|
|
|
name = fields.Char(string="Tên", required=True)
|
|
ngay_sinh = fields.Date(string="Ngày sinh")
|
|
gioi_tinh = fields.Selection(string="Giới tính", selection=_gender_list)
|
|
ngay_gia_nhap = fields.Date(string="Ngày gia nhập")
|
|
trang_thai = fields.Selection(
|
|
string="Trạng thái", selection=_stats_list, default="dang_lam"
|
|
)
|
|
trinh_do_tieng = fields.Char(string="Trình độ tiếng")
|
|
bang_cap_tieng = fields.Char(string="Bằng cấp tiếng")
|
|
|
|
def name_get(self):
|
|
return [(record.id, record.name) for record in self]
|
|
|
|
def write(self, vals):
|
|
return super().write(vals)
|
|
|
|
|
|
class QuanHeGiaoVienChuNhiemHocVien(models.Model):
|
|
_name = "cenhomes.quan_he_giao_vien_chu_nhiem_hoc_vien"
|
|
_description = "Quan Hệ GVCN - Học Viên"
|
|
|
|
hoc_vien_id = fields.Many2one(
|
|
comodel_name="cenhomes.hoc_vien",
|
|
string="Học viên",
|
|
ondelete="cascade",
|
|
required=True,
|
|
)
|
|
mshv = fields.Char(
|
|
string="Mã Số Học Viên",
|
|
related="hoc_vien_id.mshv",
|
|
store=True,
|
|
readonly=True,
|
|
)
|
|
giao_vien_id = fields.Many2one(
|
|
comodel_name="cenhomes.giao_vien_chu_nhiem",
|
|
string="Giáo viên",
|
|
ondelete="cascade",
|
|
required=True,
|
|
)
|
|
lop_hoc_id = fields.Many2one(
|
|
comodel_name="cenhomes.lop_hoc",
|
|
string="Lớp học",
|
|
ondelete="cascade",
|
|
required=True,
|
|
)
|
|
|
|
danh_gia_ky_nang = fields.Selection(
|
|
selection=Common._priority_list,
|
|
string="Đánh Giá Kỹ Năng Giảng Dạy",
|
|
)
|
|
danh_gia_tac_phong = fields.Selection(
|
|
selection=Common._priority_list,
|
|
string="Đánh Giá Tác Phong Sư Phạm",
|
|
)
|
|
|
|
ghi_chu = fields.Text(string="Ghi Chú")
|
|
file_dinh_kem = fields.Binary(string="File Đính Kèm")
|
|
file_name = fields.Char(string="Tên File")
|
|
|
|
|
|
class QuanHeGiaoVienTiengHocVien(models.Model):
|
|
_name = "cenhomes.quan_he_giao_vien_day_tieng_hoc_vien"
|
|
_description = "Quan Hệ Giáo Viên Tiếng - Học Viên"
|
|
|
|
hoc_vien_id = fields.Many2one(
|
|
ondelete="cascade",
|
|
comodel_name="cenhomes.hoc_vien",
|
|
string="Học viên",
|
|
required=True,
|
|
)
|
|
mshv = fields.Char(
|
|
string="Mã Số Học Viên",
|
|
related="hoc_vien_id.mshv",
|
|
store=True,
|
|
readonly=True,
|
|
)
|
|
giao_vien_id = fields.Many2one(
|
|
ondelete="cascade",
|
|
comodel_name="cenhomes.giao_vien_day_tieng",
|
|
string="Giáo viên",
|
|
required=True,
|
|
)
|
|
lop_hoc_id = fields.Many2one(
|
|
ondelete="cascade",
|
|
comodel_name="cenhomes.lop_hoc",
|
|
string="Lớp học",
|
|
required=True,
|
|
)
|
|
|
|
danh_gia_ky_nang = fields.Selection(
|
|
selection=Common._priority_list,
|
|
string="Đánh Giá Kỹ Năng Giảng Dạy",
|
|
)
|
|
danh_gia_tac_phong = fields.Selection(
|
|
selection=Common._priority_list,
|
|
string="Đánh Giá Tác Phong Sư Phạm",
|
|
)
|
|
|
|
ghi_chu = fields.Text(string="Ghi Chú")
|
|
file_dinh_kem = fields.Binary(string="File Đính Kèm")
|
|
file_name = fields.Char(string="Tên File")
|