2
0

Migrate account_fiscal_month.

Update tests for unlink.

Update tests.

Update unlin ktest in super.
This commit is contained in:
Fekete Mihai 2018-03-17 07:18:58 +02:00 committed by BT-anieto
parent f73a38af83
commit bd39327545
No known key found for this signature in database
5 changed files with 29 additions and 18 deletions

View File

@ -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
====================
@ -8,15 +8,12 @@ Account Fiscal Month
This module simply provides a date range type marked as 'Fiscal month'.
Installation
============
Usage
=====
Just Install it.
Configuration
=============
No configuration needed.
.. 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
===========
@ -24,7 +21,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/account-financial-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
help us smash it by providing detailed and welcomed feedback.
Credits
=======
@ -32,7 +29,7 @@ Credits
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Contributors
------------

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@ -6,7 +5,7 @@
'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',

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@ -7,7 +6,6 @@ from odoo.exceptions import UserError
class DateRangeType(models.Model):
_inherit = 'date.range.type'
fiscal_month = fields.Boolean(string="Is fiscal month?", readonly=True)

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.exceptions import UserError
from odoo.fields import Date
from odoo.tests.common import TransactionCase
from odoo.tools import mute_logger
from psycopg2 import IntegrityError
class TestAccountFiscalMonth(TransactionCase):
@ -12,11 +13,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',
@ -32,6 +46,10 @@ class TestAccountFiscalMonth(TransactionCase):
'company_id': False,
})
def test_00_delete_type(self):
with self.assertRaises(IntegrityError), mute_logger('odoo.sql_db'):
self.date_range_type.unlink()
def test_01_delete_type_fiscal_month(self):
with self.assertRaises(UserError):
self.date_range_type_month.unlink()