26
26
class OeMedicalPrescriptionLine(osv.Model):
27
27
_name = 'oemedical.prescription.line'
31
def _get_medicament(self, cr, uid, ids, name, args, context=None):
32
print '_get_medicament', name, args, context, ids
33
medication_obj = self.pool.get('oemedical.medication.template')
37
# result = {'value': {
38
# 'form' : medication_obj.browse(cr, uid, medication, context = None).form.id ,
42
# def _get_dose(self, cr, uid, ids, field_name, arg, context=None):
44
# for record in self.browse(cr, uid, ids, context=context):
45
# res[record.id] = record.template.dose
48
# def _get_frecuency(self, cr, uid, ids, field_name, arg, context=None):
50
# for record in self.browse(cr, uid, ids, context=context):
55
# def _get_duration(self, cr, uid, ids, field_name, arg, context=None):
57
# for record in self.browse(cr, uid, ids, context=context):
61
# def _get_qty(self, cr, uid, ids, field_name, arg, context=None):
63
# for record in self.browse(cr, uid, ids, context=context):
67
# def _get_frecuency_unit(self, cr, uid, ids, field_name, arg, context=None):
71
# def _get_admin_times(self, cr, uid, ids, name, args, context=None):
75
# def _get_start_treatment(self, cr, uid, ids, field_name, arg, context=None):
76
# ops = self.browse(cr, uid, ids, context=context)
82
# def _get_end_treatment(self, cr, uid, ids, field_name, arg, context=None):
83
# ops = self.browse(cr, uid, ids, context=context)
89
# def _get_duration_period(self, cr, uid, ids, field_name, arg, context=None):
91
# for line in self.browse(cr, uid, ids, context=context):
92
# res[line.id] = 'days'
95
def onchange_template(self, cr, uid, ids, medication, context=None):
96
medication_obj = self.pool.get('oemedical.medication.template')
99
'indication' : medication_obj.browse(cr, uid, medication, context = None).indication.id ,
100
'form' : medication_obj.browse(cr, uid, medication, context = None).form.id ,
101
'route' : medication_obj.browse(cr, uid, medication, context = None).route.id ,
102
'dose' : medication_obj.browse(cr, uid, medication, context = None).dose ,
103
'dose_unit' : medication_obj.browse(cr, uid, medication, context = None).dose_unit.id ,
104
'qty' : medication_obj.browse(cr, uid, medication, context = None).qty ,
105
'admin_times' : medication_obj.browse(cr, uid, medication, context = None).admin_times ,
106
'common_dosage' : medication_obj.browse(cr, uid, medication, context = None).common_dosage.id ,
107
'frequency' : medication_obj.browse(cr, uid, medication, context = None).frequency ,
108
'frequency_unit' : medication_obj.browse(cr, uid, medication, context = None).frequency_unit ,
30
'refills': fields.integer(string='Refills #'),
31
'prescription_order_id': fields.many2one(
32
'oemedical.prescription.order',
33
string='Prescription ID', ),
114
'name': fields.many2one('oemedical.prescription.order', string='Prescription ID', ),
115
'template': fields.many2one('oemedical.medication.template', string='Medication', ),
116
'indication': fields.many2one('oemedical.pathology', string='Indication', help='Choose a disease for this medicament from the disease list. It'\
117
' can be an existing disease of the patient or a prophylactic.'),
34
118
'allow_substitution': fields.boolean(string='Allow substitution'),
35
'prnt': fields.boolean(string='Print',
36
help='Check this box to print this line of the prescription.'),
119
'prnt': fields.boolean(string='Print', help='Check this box to print this line of the prescription.'),
120
'quantity': fields.integer(string='Units', help="Number of units of the medicament. Example : 30 capsules of amoxicillin"),
121
'active_component': fields.char(size=256, string='Active component', help='Active Component'),
122
'start_treatment': fields.datetime(string='Start'),
123
'end_treatment': fields.datetime(string='End'),
124
'dose' : fields.float('Dose', digits=(16, 2), help="Amount of medication (eg, 250 mg) per dose"),
125
'dose_unit': fields.many2one('product.uom', string='Dose Unit', help='Amount of medication (eg, 250 mg) per dose'),
126
'qty' : fields.integer('x'),
127
'form': fields.many2one('oemedical.drug.form', string='Form', help='Drug form, such as tablet or gel'),
128
'route': fields.many2one('oemedical.drug.route', string='Route', help='Drug form, such as tablet or gel'),
129
'common_dosage': fields.many2one('oemedical.medication.dosage', string='Frequency', help='Drug form, such as tablet or gel'),
130
'admin_times' : fields.char('Admin Hours', size=255),
131
'frequency' : fields.integer('Frequency'),
132
'frequency_unit': fields.selection([
134
('seconds', 'seconds'),
135
('minutes', 'minutes'),
139
('wr', 'when required'),
141
'frequency_prn': fields.boolean(string='Frequency prn', help=''),
142
'duration' : fields.integer('Treatment duration'),
143
'duration_period': fields.selection([
145
('minutes', 'minutes'),
148
('months', 'months'),
150
('indefinite', 'indefinite'),
151
],'Treatment period'),
152
'refills': fields.integer(string='Refills #'),
37
153
'review': fields.datetime(string='Review'),
38
'short_comment': fields.char(size=256, string='Comment',
39
help='Short comment on the specific drug'),
40
'template': fields.many2one('oemedical.medication.template',
41
string='Medication Template', ),
42
'quantity': fields.integer(string='Quantity'),
154
'short_comment': fields.char(size=256, string='Comment', help='Short comment on the specific drug'),
45
164
OeMedicalPrescriptionLine()
46
165
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: