<commit_before># -*- coding: utf-8 -*-
# #############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# #############################################################################

from openerp.osv import fields, orm


class MedicalPrescriptionLine(orm.Model):
    _name = 'medical.prescription.line'

    def _get_medicament(self, cr, uid, ids, name, args, context=None):
        # print '_get_medicament', name, args, context, ids
        # medication_obj = self.pool.get('medical.medication.template')
        result = {}

        # if name == 'form':
        # result = {'value': {
        # 'form' : medication_obj.browse(
        #     cr, uid, medication, context = None).form.id ,
        # } }
        return result

    # def _get_dose(self, cr, uid, ids, field_name, arg, context=None):
    # res = {}
    # for record in self.browse(cr, uid, ids, context=context):
    # res[record.id] = record.template.dose
    # return res

    # def _get_frecuency(self, cr, uid, ids, field_name, arg, context=None):
    # res = {}
    # for record in self.browse(cr, uid, ids, context=context):
    #            res[record.id] = 1
    #        return res

    #    def _get_duration(self, cr, uid, ids, field_name, arg, context=None):
    #        res = {}
    #        for record in self.browse(cr, uid, ids, context=context):
    #            res[record.id] = 1
    #        return res

    #    def _get_qty(self, cr, uid, ids, field_name, arg, context=None):
    #        res = {}
    #        for record in self.browse(cr, uid, ids, context=context):
    #            res[record.id] = 1
    #        return res

    #    def _get_frecuency_unit(self, cr, uid, ids, field_name, arg,
    #        context=None):
    #        res = {}
    #        return res

    #    def _get_admin_times(self, cr, uid, ids, name, args, context=None):
    #        res = {}
    #        return res

    #    def _get_start_treatment(self, cr, uid, ids, field_name, arg,
    #        context=None):
    #        ops = self.browse(cr, uid, ids, context=context)
    #        res = {}
    #        for op in ops:
    #            res[op.id] = False
    #        return res

    #    def _get_end_treatment(self, cr, uid, ids, field_name, arg,
    #        context=None):
    #        ops = self.browse(cr, uid, ids, context=context)
    #        res = {}
    #        for op in ops:
    #            res[op.id] = False
    #        return res

    #    def _get_duration_period(self, cr, uid, ids, field_name, arg,
    #        context=None):
    #        res = {}
    #        for line in self.browse(cr, uid, ids, context=context):
    #            res[line.id] = 'days'
    #        return res

    def onchange_template(self, cr, uid, ids, medication, context=None):
        medication_obj = self.pool.get('medical.medication.template')
        medication_template = medication_obj.browse(cr, uid, medication,
                                                    context=None)
        res = {'value': {
            'indication': medication_template.indication.id,
            'form': medication_template.form.id,
            'route': medication_template.route.id,
            'dose': medication_template.dose,
            'dose_unit': medication_template.dose_unit.id,
            'qty': medication_template.qty,
            'admin_times': medication_template.admin_times,
            'common_dosage': medication_template.common_dosage.id,
            'frequency': medication_template.frequency,
            'frequency_unit': medication_template.frequency_unit,
        }}
        return res

    _columns = {
        'name': fields.many2one('medical.prescription.order',
                                string='Prescription ID', ),
        'template': fields.many2one('medical.medication.template',
                                    string='Medication', ),
        'indication': fields.many2one('medical.pathology', string='Indication',
                                      help='Choose a disease for this '
                                           'medicament from the disease list. '
                                           'It can be an existing disease of '
                                           'the patient or a prophylactic.'),
        'allow_substitution': fields.boolean(string='Allow substitution'),<commit_msg>* all hail king Linus<commit_after># -*- coding: utf-8 -*-
# #############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# #############################################################################

from openerp.osv import fields, orm


class MedicalPrescriptionLine(orm.Model):
    _name = 'medical.prescription.line'

    def _get_medicament(self, cr, uid, ids, name, args, context=None):
        result = {}
        return result

    def onchange_template(self, cr, uid, ids, medication, context=None):
        medication_obj = self.pool.get('medical.medication.template')
        medication_template = medication_obj.browse(cr, uid, medication,
                                                    context=None)
        res = {'value': {
            'indication': medication_template.indication.id,
            'form': medication_template.form.id,
            'route': medication_template.route.id,
            'dose': medication_template.dose,
            'dose_unit': medication_template.dose_unit.id,
            'qty': medication_template.qty,
            'admin_times': medication_template.admin_times,
            'common_dosage': medication_template.common_dosage.id,
            'frequency': medication_template.frequency,
            'frequency_unit': medication_template.frequency_unit,
        }}
        return res

    _columns = {
        'name': fields.many2one('medical.prescription.order',
                                string='Prescription ID', ),
        'template': fields.many2one('medical.medication.template',
                                    string='Medication', ),
        'indication': fields.many2one('medical.pathology', string='Indication',
                                      help='Choose a disease for this '
                                           'medicament from the disease list. '
                                           'It can be an existing disease of '
                                           'the patient or a prophylactic.'),
        'allow_substitution': fields.boolean(string='Allow substitution'),
{'fraction_non_alphanumeric': 0.138744749196936, 'fraction_numerical': 0.0025945144551519643, 'mean_word_length': 2.236705317872851, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7581697', 'n_tokens_mistral': 2226, 'n_tokens_neox': 2124, 'n_words': 619}