Skip to content

Commit

Permalink
Merge pull request #17 from savoirfairelinux/7.0-linelength
Browse files Browse the repository at this point in the history
7.0 linelength
  • Loading branch information
pedrobaeza committed Sep 12, 2014
2 parents 00a7bfa + a954f84 commit 176d5b8
Show file tree
Hide file tree
Showing 157 changed files with 4,197 additions and 2,267 deletions.
4 changes: 2 additions & 2 deletions hr_accrual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down
14 changes: 7 additions & 7 deletions hr_accrual/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand All @@ -27,11 +27,11 @@
Accruals
========
An Accrual is any benefit (usually time) that accrues on behalf of an employee over an extended
period of time. This can be vacation days, sick days, or a simple time bank. The actual policy
and mechanics of accrual should be handled by other modules. This module only provides
the basic framework for recording the data.
""",
An Accrual is any benefit (usually time) that accrues on behalf of an employee
over an extended period of time. This can be vacation days, sick days, or a
simple time bank. The actual policy and mechanics of accrual should be handled
by other modules. This module only provides the basic framework for recording
the data.""",
'author': 'Michael Telahun Makonnen <mmakonnen@gmail.com>',
'website': 'http://miketelahun.wordpress.com',
'depends': [
Expand Down
52 changes: 40 additions & 12 deletions hr_accrual/hr_accrual.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand All @@ -31,9 +31,21 @@ class hr_accrual(orm.Model):
_description = 'Accrual'

_columns = {
'name': fields.char('Name', size=128, required=True),
'holiday_status_id': fields.many2one('hr.holidays.status', 'Leave'),
'line_ids': fields.one2many('hr.accrual.line', 'accrual_id', 'Accrual Lines', readonly=True),
'name': fields.char(
'Name',
size=128,
required=True,
),
'holiday_status_id': fields.many2one(
'hr.holidays.status',
'Leave',
),
'line_ids': fields.one2many(
'hr.accrual.line',
'accrual_id',
'Accrual Lines',
readonly=True,
),
}

def get_balance(self, cr, uid, ids, employee_id, date=None, context=None):
Expand All @@ -42,9 +54,11 @@ def get_balance(self, cr, uid, ids, employee_id, date=None, context=None):
date = time.strftime(OE_DATEFORMAT)

res = 0.0
cr.execute('''SELECT SUM(amount) from hr_accrual_line \
WHERE accrual_id in %s AND employee_id=%s AND date <= %s''',
(tuple(ids), employee_id, date))
cr.execute('''\
SELECT SUM(amount)
FROM hr_accrual_line
WHERE accrual_id in %s AND employee_id=%s AND date <= %s
''', (tuple(ids), employee_id, date))
for row in cr.fetchall():
res = row[0]

Expand All @@ -57,10 +71,24 @@ class hr_accrual_line(orm.Model):
_description = 'Accrual Line'

_columns = {
'date': fields.date('Date', required=True),
'accrual_id': fields.many2one('hr.accrual', 'Accrual', required=True),
'employee_id': fields.many2one('hr.employee', 'Employee', required=True),
'amount': fields.float('Amount', required=True),
'date': fields.date(
'Date',
required=True,
),
'accrual_id': fields.many2one(
'hr.accrual',
'Accrual',
required=True,
),
'employee_id': fields.many2one(
'hr.employee',
'Employee',
required=True,
),
'amount': fields.float(
'Amount',
required=True,
),
}

_defaults = {
Expand Down
4 changes: 2 additions & 2 deletions hr_contract_init/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down
4 changes: 2 additions & 2 deletions hr_contract_init/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down
102 changes: 73 additions & 29 deletions hr_contract_init/hr_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down Expand Up @@ -36,22 +36,49 @@ class contract_init(orm.Model):
_inherit = 'ir.needaction_mixin'

_columns = {
'name': fields.char('Name', size=64, required=True, readonly=True,
states={'draft': [('readonly', False)]}),
'date': fields.date('Effective Date', required=True, readonly=True,
states={'draft': [('readonly', False)]}),
'wage_ids': fields.one2many('hr.contract.init.wage', 'contract_init_id',
'Starting Wages', readonly=True,
states={'draft': [('readonly', False)]}),
'struct_id': fields.many2one('hr.payroll.structure', 'Payroll Structure', readonly=True,
states={'draft': [('readonly', False)]}),
'trial_period': fields.integer('Trial Period', readonly=True,
states={'draft': [('readonly', False)]},
help="Length of Trial Period, in days"),
'active': fields.boolean('Active'),
'state': fields.selection([('draft', 'Draft'),
('approve', 'Approved'),
('decline', 'Declined')], 'State', readonly=True),
'name': fields.char(
'Name',
size=64,
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
),
'date': fields.date(
'Effective Date',
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
),
'wage_ids': fields.one2many(
'hr.contract.init.wage',
'contract_init_id',
'Starting Wages', readonly=True,
states={'draft': [('readonly', False)]},
),
'struct_id': fields.many2one(
'hr.payroll.structure',
'Payroll Structure',
readonly=True,
states={'draft': [('readonly', False)]},
),
'trial_period': fields.integer(
'Trial Period',
readonly=True,
states={'draft': [('readonly', False)]},
help="Length of Trial Period, in days",
),
'active': fields.boolean(
'Active',
),
'state': fields.selection(
[
('draft', 'Draft'),
('approve', 'Approved'),
('decline', 'Declined'),
],
'State',
readonly=True,
),
}

_defaults = {
Expand Down Expand Up @@ -80,8 +107,11 @@ def unlink(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, ['state'], context=context)
for d in data:
if d['state'] in ['approve', 'decline']:
raise orm.except_orm(_('Error'),
_('You may not a delete a record that is not in a "Draft" state'))
raise orm.except_orm(
_('Error'),
_('You may not a delete a record that is not in a '
'"Draft" state')
)
return super(contract_init, self).unlink(cr, uid, ids, context=context)

def set_to_draft(self, cr, uid, ids, context=None):
Expand Down Expand Up @@ -111,29 +141,38 @@ class init_wage(orm.Model):
_description = 'Starting Wages'

_columns = {
'job_id': fields.many2one('hr.job', 'Job'),
'job_id': fields.many2one(
'hr.job',
'Job',
),
'starting_wage': fields.float(
'Starting Wage',
digits_compute=dp.get_precision('Payroll'),
required=True
),
'is_default': fields.boolean(
'Use as Default',
help="Use as default wage"
help="Use as default wage",
),
'contract_init_id': fields.many2one(
'hr.contract.init',
'Contract Settings',
),
'contract_init_id': fields.many2one('hr.contract.init', 'Contract Settings'),
'category_ids': fields.many2many(
'hr.employee.category',
'contract_init_category_rel',
'contract_init_id',
'category_id',
'Tags'
'Tags',
),
}

def _rec_message(self, cr, uid, ids, context=None):
return _('A Job Position cannot be referenced more than once in a '
'Contract Settings record.')

_sql_constraints = [
('unique_job_cinit', 'UNIQUE(job_id,contract_init_id)',
_('A Job Position cannot be referenced more than once in a Contract Settings record.')),
('unique_job_cinit', 'UNIQUE(job_id,contract_init_id)', _rec_message),
]

def unlink(self, cr, uid, ids, context=None):
Expand All @@ -148,8 +187,11 @@ def unlink(self, cr, uid, ids, context=None):
'hr.contract.init').read(cr, uid, d['contract_init_id'][0],
['state'], context=context)
if d2['state'] in ['approve', 'decline']:
raise orm.except_orm(_('Error'),
_('You may not a delete a record that is not in a "Draft" state'))
raise orm.except_orm(
_('Error'),
_('You may not a delete a record that is not in a '
'"Draft" state')
)
return super(init_wage, self).unlink(cr, uid, ids, context=context)


Expand Down Expand Up @@ -241,7 +283,9 @@ def onchange_trial(self, cr, uid, ids, trial_date_start, context=None):
return res

def get_latest_initial_values(self, cr, uid, today_str=None, context=None):
"""Return a record with an effective date before today_str but greater than all others"""
"""Return a record with an effective date before today_str
but greater than all others
"""

init_obj = self.pool.get('hr.contract.init')
if today_str is None:
Expand Down
4 changes: 2 additions & 2 deletions hr_contract_reference/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down
4 changes: 2 additions & 2 deletions hr_contract_reference/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down
11 changes: 8 additions & 3 deletions hr_contract_reference/hr_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand All @@ -27,7 +27,12 @@ class hr_contract(orm.Model):
_inherit = 'hr.contract'

_columns = {
'name': fields.char('Contract Reference', size=32, required=False, readonly=True),
'name': fields.char(
'Contract Reference',
size=32,
required=False,
readonly=True,
),
}

def create(self, cr, uid, vals, context=None):
Expand Down
4 changes: 2 additions & 2 deletions hr_contract_state/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand Down
8 changes: 4 additions & 4 deletions hr_contract_state/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All Rights Reserved.
#
# 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
# 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,
Expand All @@ -27,8 +27,8 @@
Employee Contract Workflow and Notifications
============================================
Easily find and keep track of employees who are nearing the end of their contracts and
trial periods.
Easily find and keep track of employees who are nearing the end of their
contracts and trial periods.
""",
'author': 'Michael Telahun Makonnen <mmakonnen@gmail.com>',
'website': 'http://miketelahun.wordpress.com',
Expand Down
Loading

0 comments on commit 176d5b8

Please sign in to comment.