clinic management
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
class ClinicPrescriptionLine(models.Model):
|
||||
_name = 'clinic.prescription.line'
|
||||
_description = 'Chi tiết đơn thuốc'
|
||||
_rec_name = 'prescription_id'
|
||||
|
||||
prescription_id = fields.Many2one('clinic.prescription', string='Đơn thuốc', required=True)
|
||||
medicine_id = fields.Many2one('clinic.medicine', string='Thuốc', required=True)
|
||||
quantity = fields.Integer(string='Số lượng', required=True)
|
||||
color = fields.Integer(string="Màu sắc", compute="_compute_line_color", store=True)
|
||||
|
||||
@api.depends('medicine_id.category')
|
||||
def _compute_line_color(self):
|
||||
for line in self:
|
||||
if line.medicine_id.category == 'antibiotics':
|
||||
line.color = 1
|
||||
elif line.medicine_id.category == 'painkiller':
|
||||
line.color = 2
|
||||
elif line.medicine_id.category == 'vitamins':
|
||||
line.color = 3
|
||||
else:
|
||||
line.color = 4
|
||||
Reference in New Issue
Block a user