<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    Copyright (C) 2013 EIA-FR (https://eia-fr.ch/)
#    Copyright (C) 2014 The DoMo Team (https://launchpad.net/~domo)
#    <NAME> & <NAME>
#
#    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 orm, fields
from openerp.osv.orm import except_orm
from openerp.tools.translate import _
from datetime import datetime
import calendar
from staff_utils import staff_utils

class staff_scheduler(orm.Model):
	_name="staff.scheduler"
	
	_columns={
		'user_id':fields.many2one('res.users', 'User', readonly=True, relate=True),
		'task_id':fields.many2one('account.analytic.account', 'Task', readonly=False),
		'date': fields.date('Date', readonly=True),
		'hour_from': fields.float('Start Hour', readonly=False),
		'hour_to': fields.float('End Hour', readonly=False),
		'comment':fields.char('Comment',size= 512 ,required=False),
		'work_time':fields.float('Worked time', readonly=False),
		'confirm':fields.boolean('Confirm', readonly=False),
	}
	
	#Check if the hour from is between 0 and 24
	def _check_hour_to(self,cr,uid,ids):
		for event in self.browse(cr, uid, ids):
			if(event.hour_to < 0 or event.hour_to >= 24):
				return False
		return True
	
	#Check if the hour to is between 0 and 24
	def _check_hour_from(self,cr,uid,ids):
		for event in self.browse(cr, uid, ids):
			if(event.hour_from < 0 or event.hour_from >= 24):
				return False
		return True
	
	_constraints = [(_check_hour_from,_('Start hour must be between 0 and 24.'), ['hour_from']), 
				(_check_hour_to,_('End hour must be between 0 and 24.'), ['hour_to'])]
	
	#Update elements
	#Make a control to ensure that the user can do the task.
	def write(self, cr, user, ids, vals, context=None):
		if context is not None:<commit_msg>Add replaceable information.<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    Copyright (C) 2013 EIA-FR (https://eia-fr.ch/)
#    Copyright (C) 2014 The DoMo Team (https://launchpad.net/~domo)
#    <NAME> & <NAME>
#
#    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 orm, fields
from openerp.osv.orm import except_orm
from openerp.tools.translate import _
from datetime import datetime
import calendar
from staff_utils import staff_utils

class staff_scheduler(orm.Model):
	_name="staff.scheduler"
	
	_columns={
		'user_id':fields.many2one('res.users', 'User', readonly=True, relate=True),
		'task_id':fields.many2one('account.analytic.account', 'Task', readonly=False),
		'date': fields.date('Date', readonly=True),
		'hour_from': fields.float('Start Hour', readonly=False),
		'hour_to': fields.float('End Hour', readonly=False),
		'comment':fields.char('Comment',size= 512 ,required=False),
		'work_time':fields.float('Worked time', readonly=False),
		'confirm':fields.boolean('Confirm', readonly=False),
		'replaceable':fields.boolean('Replaceable', readonly=False, default=False),
	}
	
	#Check if the hour from is between 0 and 24
	def _check_hour_to(self,cr,uid,ids):
		for event in self.browse(cr, uid, ids):
			if(event.hour_to < 0 or event.hour_to >= 24):
				return False
		return True
	
	#Check if the hour to is between 0 and 24
	def _check_hour_from(self,cr,uid,ids):
		for event in self.browse(cr, uid, ids):
			if(event.hour_from < 0 or event.hour_from >= 24):
				return False
		return True
	
	_constraints = [(_check_hour_from,_('Start hour must be between 0 and 24.'), ['hour_from']), 
				(_check_hour_to,_('End hour must be between 0 and 24.'), ['hour_to'])]
	
	#Update elements
	#Make a control to ensure that the user can do the task.
	def write(self, cr, user, ids, vals, context=None):
		if context is not None:
{'fraction_non_alphanumeric': 0.17112093828109978, 'fraction_numerical': 0.012689867333205153, 'mean_word_length': 4.581545064377682, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2119923', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1522, 'n_words': 544}