From ca24f48de344cda41a700f81ce4b72cf573b5313 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 29 Aug 2008 01:08:10 +0200 Subject: [PATCH] Modifs bzr revid: fp@tinyerp.com-20080828230810-nt2h294l3w6ox3iy --- addons/account/account.py | 10 +- addons/account/account_move_line.py | 2 +- .../crossovered_budget.py | 2 +- addons/auction/auction.py | 13 +- .../base_report_creator.py | 2 +- addons/crm/crm.py | 2 +- addons/crm/crm_segmentation.py | 2 +- addons/event/event.py | 2 +- addons/hr/__terp__.py | 2 - addons/hr/hr.py | 27 -- addons/hr/hr_bel_holidays_2005.xml | 63 ----- addons/hr/hr_demo.xml | 35 --- addons/hr/hr_report.xml | 2 +- addons/hr/hr_security.xml | 42 +-- addons/hr/hr_view.xml | 84 ------ addons/hr/report/timesheet.py | 191 -------------- addons/hr/report/timesheet.xsl | 241 ------------------ addons/hr_holidays/hr.py | 3 +- addons/hr_holidays/hr_view.xml | 42 ++- .../hr_timesheet_invoice_view.xml | 4 +- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 4 +- addons/idea/idea.py | 2 +- addons/mrp/mrp.py | 4 +- addons/mrp_operations/mrp_operations.py | 4 +- addons/project/project.py | 4 +- addons/purchase/purchase.py | 2 +- .../report_analytic_planning.py | 2 +- addons/report_crm/report_crm.py | 4 +- addons/report_task/report_task.py | 2 +- addons/sale/sale.py | 2 +- addons/scrum/scrum.py | 4 +- addons/stock/stock.py | 8 +- addons/subscription/subscription.py | 2 +- 33 files changed, 76 insertions(+), 739 deletions(-) delete mode 100644 addons/hr/hr_bel_holidays_2005.xml delete mode 100644 addons/hr/report/timesheet.py delete mode 100644 addons/hr/report/timesheet.xsl diff --git a/addons/account/account.py b/addons/account/account.py index 1c185d795d7..9e86e8ddfa5 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -463,7 +463,7 @@ class account_fiscalyear(osv.osv): 'date_start': fields.date('Start date', required=True), 'date_stop': fields.date('End date', required=True), 'period_ids': fields.one2many('account.period', 'fiscalyear_id', 'Periods'), - 'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', redonly=True), + 'state': fields.selection([('draft','Draft'), ('done','Done')], 'Status', redonly=True), } _defaults = { @@ -510,7 +510,7 @@ class account_period(osv.osv): 'date_start': fields.date('Start of period', required=True, states={'done':[('readonly',True)]}), 'date_stop': fields.date('End of period', required=True, states={'done':[('readonly',True)]}), 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True), - 'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', readonly=True) + 'state': fields.selection([('draft','Draft'), ('done','Done')], 'Status', readonly=True) } _defaults = { 'state': lambda *a: 'draft', @@ -552,7 +552,7 @@ class account_journal_period(osv.osv): 'period_id': fields.many2one('account.period', 'Period', required=True, ondelete="cascade"), 'icon': fields.function(_icon_get, method=True, string='Icon', type='string'), 'active': fields.boolean('Active', required=True), - 'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'State', required=True, readonly=True) + 'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'Status', required=True, readonly=True) } def _check(self, cr, uid, ids, context={}): @@ -627,7 +627,7 @@ class account_move(osv.osv): 'ref': fields.char('Ref', size=64), 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}), - 'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State', required=True, readonly=True), + 'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'Status', required=True, readonly=True), 'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}), } _defaults = { @@ -1447,7 +1447,7 @@ class account_subscription(osv.osv): 'period_total': fields.integer('Number of period', required=True), 'period_nbr': fields.integer('Period', required=True), 'period_type': fields.selection([('day','days'),('month','month'),('year','year')], 'Period Type', required=True), - 'state': fields.selection([('draft','Draft'),('running','Running'),('done','Done')], 'State', required=True, readonly=True), + 'state': fields.selection([('draft','Draft'),('running','Running'),('done','Done')], 'Status', required=True, readonly=True), 'lines_id': fields.one2many('account.subscription.line', 'subscription_id', 'Subscription Lines') } diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index d915a5f96cb..0f7de933e3f 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -267,7 +267,7 @@ class account_move_line(osv.osv): 'centralisation': fields.selection([('normal','Normal'),('credit','Credit Centralisation'),('debit','Debit Centralisation')], 'Centralisation', size=6), 'balance': fields.function(_balance, method=True, string='Balance'), 'active': fields.boolean('Active'), - 'state': fields.selection([('draft','Draft'), ('valid','Valid')], 'State', readonly=True), + 'state': fields.selection([('draft','Draft'), ('valid','Valid')], 'Status', readonly=True), 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account'), 'tax_amount': fields.float('Tax/Base Amount', digits=(16,2), select=True), 'invoice': fields.function(_invoice, method=True, string='Invoice', diff --git a/addons/account_budget_crossover/crossovered_budget.py b/addons/account_budget_crossover/crossovered_budget.py index 4415e31619c..461bab436a5 100644 --- a/addons/account_budget_crossover/crossovered_budget.py +++ b/addons/account_budget_crossover/crossovered_budget.py @@ -22,7 +22,7 @@ class crossovered_budget(osv.osv): 'validating_user_id': fields.many2one('res.users','Validate User', readonly=True), 'date_from': fields.date('Start Date',required=True,states={'done':[('readonly',True)]}), 'date_to': fields.date('End Date',required=True,states={'done':[('readonly',True)]}), - 'state' : fields.selection([('draft','Draft'),('confirm','Confirmed'),('validate','Validated'),('done','Done'),('cancel', 'Cancelled')], 'State', select=True, required=True, readonly=True), + 'state' : fields.selection([('draft','Draft'),('confirm','Confirmed'),('validate','Validated'),('done','Done'),('cancel', 'Cancelled')], 'Status', select=True, required=True, readonly=True), 'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines',states={'done':[('readonly',True)]} ), } diff --git a/addons/auction/auction.py b/addons/auction/auction.py index a956dc97502..d01165954fb 100644 --- a/addons/auction/auction.py +++ b/addons/auction/auction.py @@ -82,8 +82,7 @@ class auction_dates(osv.osv): 'acc_income': fields.many2one('account.account', 'Income Account', required=True), 'acc_expense': fields.many2one('account.account', 'Expense Account', required=True), 'adj_total': fields.function(_adjudication_get, method=True, string='Total Adjudication',store=True), - # 'state': fields.selection((('draft','Draft'),('closed','Closed')),'State',select=1, readonly=True), - 'state': fields.selection((('draft','Draft'),('close','Closed')),'State',select=1, readonly=True), + 'state': fields.selection((('draft','Draft'),('close','Closed')),'Status',select=1, readonly=True), 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True), } @@ -453,7 +452,7 @@ class auction_lots(osv.osv): # 'paid_vnd':fields.function(_is_paid_vnd,string='Seller Paid',method=True,type='boolean',store=True), 'paid_vnd':fields.boolean('Seller Paid'), 'paid_ach':fields.function(_is_paid_ach,string='Buyer invoice reconciled',method=True, type='boolean',store=True), - 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('paid','Paid'),('sold','Sold'),('taken_away','Taken away')),'State', required=True, readonly=True), + 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('paid','Paid'),('sold','Sold'),('taken_away','Taken away')),'Status', required=True, readonly=True), 'buyer_price': fields.function(_buyerprice, method=True, string='Buyer price',store=True), 'seller_price': fields.function(_sellerprice, method=True, string='Seller price',store=True), 'gross_revenue':fields.function(_grossprice, method=True, string='Gross revenue',store=True), @@ -995,7 +994,7 @@ class report_seller_auction(osv.osv): 'avg_price':fields.float('Avg adjudication',readonly=True), 'avg_estimation':fields.float('Avg estimation',readonly=True), 'date': fields.date('Create Date', required=True, select=1), - 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('sold','Sold')),'State',readonly=True, select=1) + 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('sold','Sold')),'Status',readonly=True, select=1) } def init(self, cr): @@ -1204,7 +1203,7 @@ class report_auction_adjudication(osv.osv): _auto = False _columns = { 'name': fields.many2one('auction.dates','Auction date',readonly=True,select=1), - 'state': fields.selection((('draft','Draft'),('close','Closed')),'State', select=1), + 'state': fields.selection((('draft','Draft'),('close','Closed')),'Status', select=1), 'adj_total': fields.float('Total Adjudication'), 'date': fields.date('Date', readonly=True,select=1), 'user_id':fields.many2one('res.users', 'User',select=1) @@ -1310,7 +1309,7 @@ class report_object_encoded(osv.osv): _description = "Object encoded" _auto = False _columns = { - 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('paid','Paid'),('invoiced','Invoiced')),'State', required=True,select=1), + 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('paid','Paid'),('invoiced','Invoiced')),'Status', required=True,select=1), 'user_id':fields.many2one('res.users', 'User', select=1), 'estimation': fields.float('Estimation',select=2), 'date': fields.date('Create Date', required=True), @@ -1380,7 +1379,7 @@ class report_unclassified_objects(osv.osv): 'obj_num': fields.integer('Catalog Number'), 'obj_price': fields.float('Adjudication price'), 'lot_num': fields.integer('List Number', required=True, select=1 ), - 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('paid','Paid'),('sold','Sold')),'State', required=True, readonly=True), + 'state': fields.selection((('draft','Draft'),('unsold','Unsold'),('paid','Paid'),('sold','Sold')),'Status', required=True, readonly=True), 'obj_comm': fields.boolean('Commission'), 'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True), 'ach_login': fields.char('Buyer Username',size=64), diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index 99f514fb8c9..4d37483579a 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -288,7 +288,7 @@ from 'model_ids': fields.many2many('ir.model', 'base_report_creator_report_model_rel', 'report_id','model_id', 'Reported Objects'), 'field_ids': fields.one2many('base_report_creator.report.fields', 'report_id', 'Fields to Display'), 'filter_ids': fields.one2many('base_report_creator.report.filter', 'report_id', 'Filters'), - 'state': fields.selection([('draft','Draft'),('valid','Valid')], 'State', required=True), + 'state': fields.selection([('draft','Draft'),('valid','Valid')], 'Status', required=True), 'sql_query': fields.function(_sql_query_get, method=True, type="text", string='SQL Query', store=True), 'group_ids': fields.many2many('res.groups', 'base_report_creator_group_rel','report_id','group_id','Authorized Groups'), } diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 06cdf8389cc..ce79cd20ebd 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -340,7 +340,7 @@ class crm_case(osv.osv): 'user_id': fields.many2one('res.users', 'User Responsible'), 'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication'), 'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History'), - 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), + 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), 'ref' : fields.reference('Reference', selection=_links_get, size=128), 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), diff --git a/addons/crm/crm_segmentation.py b/addons/crm/crm_segmentation.py index 1399a02acb0..dd6fd77f18a 100644 --- a/addons/crm/crm_segmentation.py +++ b/addons/crm/crm_segmentation.py @@ -45,7 +45,7 @@ class crm_segmentation(osv.osv): 'description': fields.text('Description'), 'categ_id': fields.many2one('res.partner.category', 'Partner Category', required=True, help='The partner category that will be added to partners that match the segmentation criterions after computation.'), 'exclusif': fields.boolean('Exclusive', help='Check if the category is limited to partners that match the segmentation criterions. If checked, remove the category from partners that doesn\'t match segmentation criterions'), - 'state': fields.selection([('not running','Not Running'),('running','Running')], 'Execution State', readonly=True), + 'state': fields.selection([('not running','Not Running'),('running','Running')], 'Execution Status', readonly=True), 'partner_id': fields.integer('Max Partner ID processed'), 'segmentation_line': fields.one2many('crm.segmentation.line', 'segmentation_id', 'Criteria', required=True), 'som_interval': fields.integer('Days per Periode', help="A period is the average number of days between two cycle of sale or purchase for this segmentation. It's mainly used to detect if a partner has not purchased or buy for a too long time, so we suppose that his state of mind has decreased because he probably bought goods to another supplier. Use this functionnality for recurring businesses."), diff --git a/addons/event/event.py b/addons/event/event.py index b1429f08773..adfe5b04386 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -133,7 +133,7 @@ class event(osv.osv): 'task_ids': one2many_mod_task('project.task', 'project_id', "Project tasks", readonly=True, domain="[('state','<>', 'done')]"), 'date_begin': fields.datetime('Beginning date', required=True), 'date_end': fields.datetime('Ending date', required=True), - 'state': fields.selection([('draft','Draft'),('confirm','Confirmed'),('done','Done'),('cancel','Canceled')], 'State', readonly=True, required=True), + 'state': fields.selection([('draft','Draft'),('confirm','Confirmed'),('done','Done'),('cancel','Canceled')], 'Status', readonly=True, required=True), 'mail_auto_registr':fields.boolean('Mail Auto Register',help='A mail is send when the registration is confirmed'), 'mail_auto_confirm':fields.boolean('Mail Auto Confirm',help='A mail is send when the event is confimed'), 'mail_registr':fields.text('Mail Register',help='Template for the mail'), diff --git a/addons/hr/__terp__.py b/addons/hr/__terp__.py index 99529fa9232..3c56bd5da4d 100644 --- a/addons/hr/__terp__.py +++ b/addons/hr/__terp__.py @@ -37,7 +37,6 @@ * Employees and hierarchies * Work hours sheets * Attendances and sign in/out system - * Holidays Different reports are also provided, mainly for attendance statistics. """, @@ -45,7 +44,6 @@ "init_xml" : [], "demo_xml" : [ "hr_demo.xml", - "hr_bel_holidays_2005.xml", "hr_department_demo.xml", ], "update_xml" : [ diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 36a65feafd9..ab75529d4b8 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -255,30 +255,3 @@ class hr_attendance(osv.osv): _order = 'name desc' hr_attendance() -class hr_holidays_status(osv.osv): - _name = "hr.holidays.status" - _description = "Holidays Status" - _columns = { - 'name' : fields.char('Holiday Status', size=64, required=True, translate=True), - } -hr_holidays_status() - -class hr_holidays(osv.osv): - _name = "hr.holidays" - _description = "Holidays" - _columns = { - 'name' : fields.char('Description', required=True, size=64), - 'date_from' : fields.datetime('Vacation start day', required=True), - 'date_to' : fields.datetime('Vacation end day'), - 'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status"), - 'employee_id' : fields.many2one('hr.employee', 'Employee', select=True), - } - _defaults = { - 'employee_id' : _employee_get - } - _order = 'date_from desc' -hr_holidays() - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/hr/hr_bel_holidays_2005.xml b/addons/hr/hr_bel_holidays_2005.xml deleted file mode 100644 index b53b135348b..00000000000 --- a/addons/hr/hr_bel_holidays_2005.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Public holidays - - - - New Year - 2005-01-01 00:00 - 2005-01-02 00:00 - - - - Easter Monday - 2005-03-28 00:00 - 2005-03-29 00:00 - - - - Labor Day - 2005-05-01 00:00 - 2005-05-02 00:00 - - - - Ascension - 2005-05-05 00:00 - 2005-05-06 00:00 - - - - Ascension Day - 2005-05-16 00:00 - 2005-05-17 00:00 - - - - Pentecost Monday - 2005-05-16 00:00 - 2005-05-17 00:00 - - - - National day - 2005-07-21 00:00 - 2005-07-22 00:00 - - - - All Saints - 2005-11-01 00:00 - 2005-11-02 00:00 - - - - Christmas - 2005-12-25 00:00 - 2005-12-26 00:00 - - - - \ No newline at end of file diff --git a/addons/hr/hr_demo.xml b/addons/hr/hr_demo.xml index c447d675470..dfdcb02e24c 100644 --- a/addons/hr/hr_demo.xml +++ b/addons/hr/hr_demo.xml @@ -1,9 +1,6 @@ - - - Start of shift @@ -30,23 +27,6 @@ sign_out - - Unpaid holidays - - - Annual holidays - - - Sickness holidays - - - Maternity holidays - - - Unauthorised holidays - - - @@ -129,21 +109,6 @@ - - Bali Trip - 2005-05-11 08:00 - 2005-05-25 18:00 - - - - - Paternity holiday - 2005-06-02 08:00 - 2005-06-13 18:00 - - - - sign_in diff --git a/addons/hr/hr_report.xml b/addons/hr/hr_report.xml index ad52de20cbf..60de2e0b3c1 100644 --- a/addons/hr/hr_report.xml +++ b/addons/hr/hr_report.xml @@ -3,4 +3,4 @@ - \ No newline at end of file + diff --git a/addons/hr/hr_security.xml b/addons/hr/hr_security.xml index 3f630c51eca..4d7291a7d37 100644 --- a/addons/hr/hr_security.xml +++ b/addons/hr/hr_security.xml @@ -155,45 +155,5 @@ - - - - HR Holiday Status - - - - - - - - - HR Holiday Status - - - - - - - - - - - HR Holidays - - - - - - - - - HR Holidays - - - - - - - - \ No newline at end of file + diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index a01f293d56e..c13e7cd9eac 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -323,90 +323,6 @@ - - - hr.holidays.form - hr.holidays - form - -
- - - - - - - -
- - hr.holidays.tree - hr.holidays - tree - - - - - - - - - - - - hr.holidays.ask_form - hr.holidays - form - -
- - - - - - - - -
- - Vacation Requests - hr.holidays - form - - - - - - - - hr.holidays.status.form - hr.holidays.status - form - -
- - -
-
- - hr.holidays.status.tree - hr.holidays.status - tree - - - - - - - - Holiday Status - ir.actions.act_window - hr.holidays.status - form - tree,form - - - - hr.action.reason.form hr.action.reason diff --git a/addons/hr/report/timesheet.py b/addons/hr/report/timesheet.py deleted file mode 100644 index 780b101c0e3..00000000000 --- a/addons/hr/report/timesheet.py +++ /dev/null @@ -1,191 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. -# -# $Id$ -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract a Free Software -# Service Company -# -# This program is Free Software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -from mx import DateTime -from mx.DateTime import now - -import netsvc -import pooler - -from report.interface import report_rml -from report.interface import toxml - -one_week = DateTime.RelativeDateTime(days=7) -num2day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] - -def to_hour(h): - return int(h), int(round((h - int(h)) * 60, 0)) - -class report_custom(report_rml): - def create_xml(self, cr, uid, ids, datas, context): - service = netsvc.LocalService('object_proxy') - - start_date = DateTime.strptime(datas['form']['init_date'], '%Y-%m-%d') - end_date = DateTime.strptime(datas['form']['end_date'], '%Y-%m-%d') - first_monday = start_date - DateTime.RelativeDateTime(days=start_date.day_of_week) - last_monday = end_date + DateTime.RelativeDateTime(days=7 - end_date.day_of_week) - - if last_monday < first_monday: - first_monday, last_monday = last_monday, first_monday - - user_xml = [] - - jf_sql = """select hol.date_from, hol.date_to from hr_holidays as hol, hr_holidays_status as stat - where hol.holiday_status = stat.id and stat.name = 'Public holidays' """ - cr.execute(jf_sql) - jfs = [] - jfs = [(DateTime.strptime(l['date_from'], '%Y-%m-%d %H:%M:%S'), DateTime.strptime(l['date_to'], '%Y-%m-%d %H:%M:%S')) for l in cr.dictfetchall()] - - for employee_id in ids: - emp = service.execute(cr.dbname, uid, 'hr.employee', 'read', [employee_id], ['id', 'name'])[0] - monday, n_monday = first_monday, first_monday + one_week - stop, week_xml = False, [] - user_repr = ''' - - %s - %%s - - ''' % toxml(emp['name']) - while monday != last_monday: - #### Work hour calculation - sql = ''' - select action, att.name - from hr_employee as emp inner join hr_attendance as att - on emp.id = att.employee_id - where att.name between '%s' and '%s' and emp.id = %s - order by att.name - ''' - for idx in range(7): - cr.execute(sql, (monday, monday + DateTime.RelativeDateTime(days=idx+1), employee_id)) - attendences = cr.dictfetchall() - week_wh = {} - if attendences and attendences[0]['action'] == 'sign_out': - attendences.insert(0, {'name': monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) - if attendences and attendences[-1]['action'] == 'sign_in': - attendences.append({'name' : n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) - for att in attendences: - dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') - if att['action'] == 'sign_out': - week_wh[ldt.day_of_week] = week_wh.get(ldt.day_of_week, 0) + (dt - ldt).hours - ldt = dt - - #### Theoretical workhour calculation - week_twh = {} - sql = ''' - select t.hour_from, t.hour_to - from hr_timesheet as t - inner join (hr_timesheet_group as g inner join hr_timesheet_employee_rel as rel - on rel.tgroup_id = g.id and rel.emp_id = %s) - on t.tgroup_id = g.id - where dayofweek = %s - and date_from = (select max(date_from) - from hr_timesheet inner join (hr_timesheet_employee_rel - inner join hr_timesheet_group - on hr_timesheet_group.id = hr_timesheet_employee_rel.tgroup_id - and hr_timesheet_employee_rel.emp_id = %s) - on hr_timesheet.tgroup_id = hr_timesheet_group.id - where dayofweek = %s and date_from <= '%s') - order by date_from desc - ''' - for idx in range(7): - day = monday + DateTime.RelativeDateTime(days=idx+1) - # Is this a public holiday ? - isPH = False - for jf_start, jf_end in jfs: - if jf_start <= day < jf_end: - isPH = True - break - if isPH: - week_twh[idx] = 0 - else: - cr.execute(sql, (emp['id'], day.day_of_week, emp['id'], day.day_of_week, day)) - dhs = cr.dictfetchall() - week_twh[idx] = reduce(lambda x,y:x+(DateTime.strptime(y['hour_to'], '%H:%M:%S') - DateTime.strptime(y['hour_from'], '%H:%M:%S')).hours,dhs, 0) - - #### Holiday calculation - sql = ''' - select hol.date_from, hol.date_to, stat.name as status - from hr_employee as emp - inner join (hr_holidays as hol left join hr_holidays_status as stat - on hol.holiday_status = stat.id) - on emp.id = hol.employee_id - where ((hol.date_from <= '%s' and hol.date_to >= '%s') - or (hol.date_from < '%s' and hol.date_to >= '%s') - or (hol.date_from > '%s' and hol.date_to < '%s') - and stat.name != 'Public holidays') and emp.id = %s - order by hol.date_from - ''' - cr.execute(sql, (monday, monday, n_monday, n_monday, monday, n_monday, employee_id)) - holidays = cr.dictfetchall() - week_hol = {} - for hol in holidays: - df = DateTime.strptime(hol['date_from'], '%Y-%m-%d %H:%M:%S') - dt = DateTime.strptime(hol['date_to'], '%Y-%m-%d %H:%M:%S') - for idx in range(7): - day = monday + DateTime.RelativeDateTime(days=idx+1) - if (df.year, df.month, df.day) <= (day.year, day.month, day.day) <= (dt.year, dt.month, dt.day): - if (df.year, df.month, df.day) == (dt.year, dt.month, dt.day): - week_hol[idx] = {'status' : hol['status'], 'hours' : (dt - df).hours} - else: - week_hol[idx] = {'status' : hol['status'], 'hours' : week_twh[idx]} - - # Week xml representation - week_repr = ['', '%s' % monday.strftime('%Y-%m-%d'), '%s' % n_monday.strftime('%Y-%m-%d')] - for idx in range(7): - week_repr.append('<%s>' % num2day[idx]) - week_repr.append('%sh%02d' % to_hour(week_twh[idx])) - if idx in week_wh: - week_repr.append('%sh%02d' % to_hour(week_wh[idx])) - if idx in week_hol and week_hol[idx]['hours']: - week_repr.append('%(hours)s' % week_hol[idx]) - week_repr.append('' % num2day[idx]) - week_repr.append('') - week_repr.append('%sh%02d' % to_hour(reduce(lambda x,y:x+y, week_twh.values(), 0))) - week_repr.append('%sh%02d' % to_hour(reduce(lambda x,y:x+y, week_wh.values(), 0))) - week_repr.append('%sh%02d' % to_hour(reduce(lambda x,y:x+y, [day['hours'] for day in week_hol.values()], 0))) - week_repr.append('') - week_repr.append('') - if len(week_repr) > 30: # 30 = minimal length of week_repr - week_xml.append('\n'.join(week_repr)) - - monday, n_monday = n_monday, n_monday + one_week - user_xml.append(user_repr % '\n'.join(week_xml)) - - xml = ''' - - %s - - ''' % '\n'.join(user_xml) - return self.post_process_xml_data(cr, uid, xml, context) - -report_custom('report.hr.timesheet.allweeks', 'hr.employee', '', 'addons/hr/report/timesheet.xsl') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/hr/report/timesheet.xsl b/addons/hr/report/timesheet.xsl deleted file mode 100644 index d318f2bf614..00000000000 --- a/addons/hr/report/timesheet.xsl +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - a4_normal - - - - - - - - - - - - - - - - - - - - - - Name: - - - - - - Mon - Tue - Wed - Thu - Fri - Sat - Sun - Tot - - - - - Week : - - from to - - - Theoretical workhours - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - Workhours - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - Holiday hours - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - 0 - - - - - - - - - - diff --git a/addons/hr_holidays/hr.py b/addons/hr_holidays/hr.py index f40a1668b90..e541f69c3ce 100644 --- a/addons/hr_holidays/hr.py +++ b/addons/hr_holidays/hr.py @@ -52,7 +52,7 @@ class hr_holidays(osv.osv): _description = "Holidays" _columns = { 'name' : fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)]}), - 'state': fields.selection([('draft', 'draft'), ('confirm', 'Confirmed'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), + 'state': fields.selection([('draft', 'draft'), ('confirm', 'Confirmed'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'Status', readonly=True), 'date_from' : fields.datetime('Vacation start day', required=True, readonly=True, states={'draft':[('readonly',False)]}), 'date_to' : fields.datetime('Vacation end day',required=True,readonly=True, states={'draft':[('readonly',False)]}), 'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status", required=True,readonly=True, states={'draft':[('readonly',False)]}), @@ -176,6 +176,7 @@ class hr_holidays_status(osv.osv): _inherit = 'hr.holidays.status' _description = "Holidays Status" _columns = { + 'name' : fields.char('Holiday Status', size=64, required=True, translate=True), 'section_id': fields.many2one('crm.case.section', 'Section'), 'color_name' : fields.selection([('red', 'Red'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color of the status', required=True), } diff --git a/addons/hr_holidays/hr_view.xml b/addons/hr_holidays/hr_view.xml index d6ff0d7443e..b37ec0cebf1 100644 --- a/addons/hr_holidays/hr_view.xml +++ b/addons/hr_holidays/hr_view.xml @@ -6,10 +6,15 @@ hr.holidays.form.inherit hr.holidays - form + - +
+ + + + +