Migrate account_fiscal_month.
Update tests for unlink. Update tests. Update unlin ktest in super.
This commit is contained in:
parent
f73a38af83
commit
bd39327545
|
@ -1,5 +1,5 @@
|
||||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: https://www.gnu.org/licenses/agpl
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
|
|
||||||
====================
|
====================
|
||||||
|
@ -8,15 +8,12 @@ Account Fiscal Month
|
||||||
|
|
||||||
This module simply provides a date range type marked as 'Fiscal month'.
|
This module simply provides a date range type marked as 'Fiscal month'.
|
||||||
|
|
||||||
Installation
|
Usage
|
||||||
============
|
=====
|
||||||
|
|
||||||
Just Install it.
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||||
|
:alt: Try me on Runbot
|
||||||
Configuration
|
:target: https://runbot.odoo-community.org/runbot/92/11.0
|
||||||
=============
|
|
||||||
|
|
||||||
No configuration needed.
|
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
@ -24,7 +21,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues
|
Bugs are tracked on `GitHub Issues
|
||||||
<https://github.com/OCA/account-financial-tools/issues>`_. In case of trouble, please
|
<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,
|
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
|
Credits
|
||||||
=======
|
=======
|
||||||
|
@ -32,7 +29,7 @@ Credits
|
||||||
Images
|
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
|
Contributors
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 ACSONE SA/NV
|
# Copyright 2017 ACSONE SA/NV
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
@ -6,7 +5,7 @@
|
||||||
'name': 'Account Fiscal Month',
|
'name': 'Account Fiscal Month',
|
||||||
'summary': """
|
'summary': """
|
||||||
Provide a fiscal month date range type""",
|
Provide a fiscal month date range type""",
|
||||||
'version': '10.0.1.0.0',
|
'version': '11.0.1.0.0',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
|
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
|
||||||
'website': 'https://www.acsone.eu',
|
'website': 'https://www.acsone.eu',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 ACSONE SA/NV
|
# Copyright 2017 ACSONE SA/NV
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# 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):
|
class DateRangeType(models.Model):
|
||||||
|
|
||||||
_inherit = 'date.range.type'
|
_inherit = 'date.range.type'
|
||||||
|
|
||||||
fiscal_month = fields.Boolean(string="Is fiscal month?", readonly=True)
|
fiscal_month = fields.Boolean(string="Is fiscal month?", readonly=True)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 ACSONE SA/NV
|
# Copyright 2017 ACSONE SA/NV
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 ACSONE SA/NV
|
# Copyright 2017 ACSONE SA/NV
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
from odoo.fields import Date
|
from odoo.fields import Date
|
||||||
from odoo.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
|
from odoo.tools import mute_logger
|
||||||
|
from psycopg2 import IntegrityError
|
||||||
|
|
||||||
|
|
||||||
class TestAccountFiscalMonth(TransactionCase):
|
class TestAccountFiscalMonth(TransactionCase):
|
||||||
|
@ -12,11 +13,24 @@ class TestAccountFiscalMonth(TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestAccountFiscalMonth, self).setUp()
|
super(TestAccountFiscalMonth, self).setUp()
|
||||||
self.DateRangeObj = self.env['date.range']
|
self.DateRangeObj = self.env['date.range']
|
||||||
|
self.DateRangeType = self.env['date.range.type']
|
||||||
|
|
||||||
self.company = self.env.ref('base.main_company')
|
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(
|
self.date_range_type_month = self.env.ref(
|
||||||
'account_fiscal_month.date_range_fiscal_month')
|
'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({
|
self.date_range_january_2017 = self.DateRangeObj.create({
|
||||||
'name': "January 2017",
|
'name': "January 2017",
|
||||||
'date_start': '2017-01-01',
|
'date_start': '2017-01-01',
|
||||||
|
@ -32,6 +46,10 @@ class TestAccountFiscalMonth(TransactionCase):
|
||||||
'company_id': False,
|
'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):
|
def test_01_delete_type_fiscal_month(self):
|
||||||
with self.assertRaises(UserError):
|
with self.assertRaises(UserError):
|
||||||
self.date_range_type_month.unlink()
|
self.date_range_type_month.unlink()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user