Skip to content

Commit

Permalink
Migrate account_fiscal_month.
Browse files Browse the repository at this point in the history
Update tests for unlink.

Update tests.
  • Loading branch information
Fekete Mihai committed Mar 19, 2018
1 parent b07dd2d commit e76314d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
11 changes: 9 additions & 2 deletions account_fiscal_month/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

====================
Expand All @@ -18,6 +18,13 @@ Configuration

No configuration needed.

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/92/11.0

Bug Tracker
===========

Expand Down
3 changes: 1 addition & 2 deletions account_fiscal_month/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Account Fiscal Month',
'summary': """
Provide a fiscal month date range type""",
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
'website': 'https://www.acsone.eu',
Expand Down
2 changes: 0 additions & 2 deletions account_fiscal_month/models/date_range_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand All @@ -7,7 +6,6 @@


class DateRangeType(models.Model):

_inherit = 'date.range.type'

fiscal_month = fields.Boolean(string="Is fiscal month?", readonly=True)
Expand Down
1 change: 0 additions & 1 deletion account_fiscal_month/models/res_company.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
19 changes: 18 additions & 1 deletion account_fiscal_month/tests/test_account_fiscal_month.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand All @@ -12,11 +11,24 @@ class TestAccountFiscalMonth(TransactionCase):
def setUp(self):
super(TestAccountFiscalMonth, self).setUp()
self.DateRangeObj = self.env['date.range']
self.DateRangeType = self.env['date.range.type']

self.company = self.env.ref('base.main_company')

self.date_range_type = self.DateRangeType.create(
{'name': 'Other Type',
'allow_overlap': False})
self.date_range_type_month = self.env.ref(
'account_fiscal_month.date_range_fiscal_month')

self.date_range_1 = self.DateRangeObj.create({
'name': "Other",
'date_start': '2017-01-01',
'date_end': '2017-01-31',
'type_id': self.date_range_type.id,
'company_id': self.company.id,
})

self.date_range_january_2017 = self.DateRangeObj.create({
'name': "January 2017",
'date_start': '2017-01-01',
Expand All @@ -32,6 +44,11 @@ def setUp(self):
'company_id': False,
})

def test_00_delete_type(self):
with self.assertRaises(Exception):
with self.env.cr.savepoint():
self.date_range_type.unlink()

def test_01_delete_type_fiscal_month(self):
with self.assertRaises(UserError):
self.date_range_type_month.unlink()
Expand Down

0 comments on commit e76314d

Please sign in to comment.