Skip to content

Commit

Permalink
1. Add unittest
Browse files Browse the repository at this point in the history
2. Add header on test .py
3. Change Warning into UserError
  • Loading branch information
andhit-r committed Apr 12, 2016
1 parent 1611894 commit 147ad91
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 251 deletions.
7 changes: 4 additions & 3 deletions hr_worked_days_from_timesheet/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,19 @@ Contributors
* David Dufresne <[email protected]>
* Pierre Lamarche <[email protected]>
* Ignacio Ibeas <[email protected]>
* OpenSynergy Indonesia <https://opensynergy-indonesia.com>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.
25 changes: 5 additions & 20 deletions hr_worked_days_from_timesheet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 - 2014 Odoo Canada. 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
# (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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2012 - 2014 Odoo Canada
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from . import models
from . import tests
33 changes: 6 additions & 27 deletions hr_worked_days_from_timesheet/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Odoo Canada. All Rights Reserved.
# Copyright (C) 2015 Acysos S.L. 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
# (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/>.
#
##############################################################################

# -*- coding: utf-8 -*-
# © 2012 - 2014 Odoo Canada
# © 2015 Acysos S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
{
'name': 'Worked Days From Timesheet',
'version': '8.0.1.0.0',
'license': 'AGPL-3',
'category': 'Generic Modules/Human Resources',
'author': "Savoir-faire Linux, Acysos SL, \
Acysos S.L., \
Odoo Community Association (OCA)",
'author': "Savoir-faire Linux, Acysos SL,Acysos S.L.,"
"Odoo Community Association (OCA)",
'website': 'https://www.savoirfairelinux.com/',
'depends': [
'hr_payroll',
Expand All @@ -35,8 +17,5 @@
'data': [
'views/hr_payslip_view.xml'
],
'test': [
'test/worked_days_from_timesheet_test.yml'
],
'installable': True,
}
24 changes: 4 additions & 20 deletions hr_worked_days_from_timesheet/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 - 2014 Odoo Canada. 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
# (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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2012 - 2014 Odoo Canada
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from . import hr_payslip_worked_days
from . import hr_payslip
30 changes: 7 additions & 23 deletions hr_worked_days_from_timesheet/models/hr_payslip.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 - 2014 Odoo Canada. All Rights Reserved.
# Copyright (C) 2015 Acysos S.L. 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
# (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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2012 - 2014 Odoo Canada
# © 2015 Acysos S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from openerp import models, fields, api
from openerp.tools.translate import _
from openerp.exceptions import Warning
from openerp.exceptions import Warning as UserError


class HrPayslip(models.Model):
Expand Down Expand Up @@ -83,7 +67,7 @@ def import_worked_days(self):
)

if not timesheet_sheets:
raise Warning(
raise UserError(
_("Sorry, but there is no approved Timesheets for the \
entire Payslip period"),
)
Expand Down
26 changes: 5 additions & 21 deletions hr_worked_days_from_timesheet/models/hr_payslip_worked_days.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 - 2014 Odoo Canada. All Rights Reserved.
# Copyright (C) 2015 Acysos S.L. 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
# (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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2012 - 2014 Odoo Canada
# © 2015 Acysos S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from openerp import models, fields


Expand Down
137 changes: 0 additions & 137 deletions hr_worked_days_from_timesheet/test/worked_days_from_timesheet_test.yml

This file was deleted.

5 changes: 5 additions & 0 deletions hr_worked_days_from_timesheet/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 OpenSynergy Indonesia <https://opensynergy-indonesia.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import test_worked_days_from_timesheet
Loading

0 comments on commit 147ad91

Please sign in to comment.