60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields
|
|
|
|
class StockLot(models.Model):
|
|
_inherit = 'stock.lot'
|
|
|
|
is_lab_sample = fields.Boolean(string='Is a Laboratory Sample')
|
|
|
|
patient_id = fields.Many2one(
|
|
'res.partner',
|
|
string='Patient',
|
|
domain="[('is_patient', '=', True)]"
|
|
)
|
|
|
|
request_id = fields.Many2one(
|
|
'sale.order',
|
|
string='Lab Request',
|
|
domain="[('is_lab_request', '=', True)]"
|
|
)
|
|
|
|
collection_date = fields.Datetime(string='Collection Date')
|
|
|
|
container_type = fields.Selection([
|
|
('serum_tube', 'Serum Tube'),
|
|
('edta_tube', 'EDTA Tube'),
|
|
('swab', 'Swab'),
|
|
('urine', 'Urine Container'),
|
|
('other', 'Other')
|
|
], string='Container Type')
|
|
|
|
collector_id = fields.Many2one(
|
|
'res.users',
|
|
string='Collected by',
|
|
default=lambda self: self.env.user
|
|
)
|
|
|
|
state = fields.Selection([
|
|
('collected', 'Recolectada'),
|
|
('received', 'Recibida en Laboratorio'),
|
|
('in_process', 'En Proceso'),
|
|
('analyzed', 'Analizada'),
|
|
('stored', 'Almacenada'),
|
|
('disposed', 'Desechada')
|
|
], string='Estado', default='collected', tracking=True)
|
|
|
|
def action_receive(self):
|
|
self.write({'state': 'received'})
|
|
|
|
def action_start_analysis(self):
|
|
self.write({'state': 'in_process'})
|
|
|
|
def action_complete_analysis(self):
|
|
self.write({'state': 'analyzed'})
|
|
|
|
def action_store(self):
|
|
self.write({'state': 'stored'})
|
|
|
|
def action_dispose(self):
|
|
self.write({'state': 'disposed'})
|