clinic management

This commit is contained in:
XuanHuyen
2025-03-22 09:11:09 +07:00
parent 37590ce057
commit 662726af4e
21 changed files with 587 additions and 0 deletions
@@ -0,0 +1,30 @@
from odoo import models, fields, api
class ClinicAppointment(models.Model):
_name = 'clinic.appointment'
_description = 'Lịch hẹn'
_rec_name = 'patient_id'
patient_id = fields.Many2one('clinic.patient', string='Bệnh nhân', required=True)
doctor_id = fields.Many2one('res.partner', string='Bác sĩ', required=True)
date = fields.Date(string='Ngày kê đơn', default=fields.Date.today)
state = fields.Selection([
('scheduled', 'Đã lên lịch'),
('done', 'Hoàn thành'),
('cancel', 'Hủy')
], string='Trạng thái', default='scheduled')
services_ids = fields.Many2many('clinic.service', string='Dịch vụ khám')
total_price = fields.Float(string='Tổng tiền', compute='_compute_total_price')
def action_scheduled(self):
self.state = 'scheduled'
def action_done(self):
self.state = 'done'
def action_cancel(self):
self.state = 'cancel'
@api.depends('services_ids')
def _compute_total_price(self):
for rec in self:
rec.total_price = sum(rec.services_ids.mapped('price'))