<commit_before># -*- coding: utf-8 -*-
from openerp.osv import orm, fields, osv
import logging        
_logger = logging.getLogger(__name__)
from openerp import tools
from openerp.addons.t4activity.activity import except_if
from openerp import SUPERUSER_ID

class wardboard_patient_placement(orm.TransientModel):
    _name = "wardboard.patient.placement"
    _columns = {
        'patient_id': fields.many2one('t4.clinical.patient', 'Patient'),
        'ward_location_id':  fields.many2one('t4.clinical.location', "Ward"),
        'bed_src_location_id':  fields.many2one('t4.clinical.location', "Source Bed"),
        'bed_dst_location_id':  fields.many2one('t4.clinical.location', "Destination Bed")
    }
    def do_move(self, cr, uid, ids, context=None):
        wiz = self.browse(cr, uid, ids[0])
        spell_activity_id = self.pool['t4.clinical.api'].get_patient_spell_activity_id(cr, uid, wiz.patient_id.id)
        placement_activity_id = self.pool['t4.clinical.patient.placement']\
                                .create_activity(cr, SUPERUSER_ID, {'parent_id': spell_activity_id}, 
                                                           {
                                                            'suggested_location_id': wiz.bed_dst_location_id.id,
                                                            'location_id': wiz.bed_dst_location_id.id,
                                                            'patient_id': wiz.patient_id.id
                                                           })
        self.pool['t4.activity'].complete(cr, uid, placement_activity_id, context)

class wardboard_device_session_start(orm.TransientModel):
    _name = "wardboard.device.session.start"
    _columns = {
        'patient_id': fields.many2one('t4.clinical.patient', 'Patient'),
        'device_id':  fields.many2one('t4.clinical.device',"Device"),
    }
    def do_start(self, cr, uid, ids, context=None):
        wiz = self.browse(cr, uid, ids[0])
        spell_activity_id = self.pool['t4.clinical.api'].get_patient_spell_activity_id(cr, uid, wiz.patient_id.id)
        device_activity_id = self.pool['t4.clinical.device.session'].create_activity(cr, SUPERUSER_ID, 
                                                {'parent_id': spell_activity_id},
                                                {'patient_id': wiz.patient_id.id, 'device_id': wiz.device_id.id})
        self.pool['t4.activity'].start(cr, uid, device_activity_id, context)        
        import pdb; pdb.set_trace()
class wardboard_device_session_complete(orm.TransientModel):
    _name = "wardboard.device.session.complete"

    _columns = {

        'session_id': fields.many2one('t4.clinical.device.session', 'Session'),
    }   
    
    def do_complete(self, cr, uid, ids, context=None):
        activity_pool = self.pool['t4.activity']
        wiz = self.browse(cr, uid, ids[0])
        activity_pool.complete(cr, uid, wiz.session_id.activity_id.id, context)
        # refreshing view
        spell_activity_id = wiz.session_id.activity_id.parent_id.id
        wardboard_pool = self.pool['t4.clinical.wardboard']
        wardboard_id = wardboard_pool.search(cr, uid, [['spell_activity_id','=',spell_activity_id]])[0]<commit_msg>[FIX] Remove import pdb from wardboard code<commit_after># -*- coding: utf-8 -*-
from openerp.osv import orm, fields, osv
import logging        
_logger = logging.getLogger(__name__)
from openerp import tools
from openerp.addons.t4activity.activity import except_if
from openerp import SUPERUSER_ID

class wardboard_patient_placement(orm.TransientModel):
    _name = "wardboard.patient.placement"
    _columns = {
        'patient_id': fields.many2one('t4.clinical.patient', 'Patient'),
        'ward_location_id':  fields.many2one('t4.clinical.location', "Ward"),
        'bed_src_location_id':  fields.many2one('t4.clinical.location', "Source Bed"),
        'bed_dst_location_id':  fields.many2one('t4.clinical.location', "Destination Bed")
    }
    def do_move(self, cr, uid, ids, context=None):
        wiz = self.browse(cr, uid, ids[0])
        spell_activity_id = self.pool['t4.clinical.api'].get_patient_spell_activity_id(cr, uid, wiz.patient_id.id)
        placement_activity_id = self.pool['t4.clinical.patient.placement']\
                                .create_activity(cr, SUPERUSER_ID, {'parent_id': spell_activity_id}, 
                                                           {
                                                            'suggested_location_id': wiz.bed_dst_location_id.id,
                                                            'location_id': wiz.bed_dst_location_id.id,
                                                            'patient_id': wiz.patient_id.id
                                                           })
        self.pool['t4.activity'].complete(cr, uid, placement_activity_id, context)

class wardboard_device_session_start(orm.TransientModel):
    _name = "wardboard.device.session.start"
    _columns = {
        'patient_id': fields.many2one('t4.clinical.patient', 'Patient'),
        'device_id':  fields.many2one('t4.clinical.device',"Device"),
    }
    def do_start(self, cr, uid, ids, context=None):
        wiz = self.browse(cr, uid, ids[0])
        spell_activity_id = self.pool['t4.clinical.api'].get_patient_spell_activity_id(cr, uid, wiz.patient_id.id)
        device_activity_id = self.pool['t4.clinical.device.session'].create_activity(cr, SUPERUSER_ID, 
                                                {'parent_id': spell_activity_id},
                                                {'patient_id': wiz.patient_id.id, 'device_id': wiz.device_id.id})
        self.pool['t4.activity'].start(cr, uid, device_activity_id, context)        
class wardboard_device_session_complete(orm.TransientModel):
    _name = "wardboard.device.session.complete"

    _columns = {

        'session_id': fields.many2one('t4.clinical.device.session', 'Session'),
    }   
    
    def do_complete(self, cr, uid, ids, context=None):
        activity_pool = self.pool['t4.activity']
        wiz = self.browse(cr, uid, ids[0])
        activity_pool.complete(cr, uid, wiz.session_id.activity_id.id, context)
        # refreshing view
        spell_activity_id = wiz.session_id.activity_id.parent_id.id
        wardboard_pool = self.pool['t4.clinical.wardboard']
        wardboard_id = wardboard_pool.search(cr, uid, [['spell_activity_id','=',spell_activity_id]])[0]
{'fraction_non_alphanumeric': 0.11941687344913152, 'fraction_numerical': 0.008684863523573201, 'mean_word_length': 2.3397203521491456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5908225', 'n_tokens_mistral': 1985, 'n_tokens_neox': 1917, 'n_words': 298}