From bd39327545a17e723e87dde0a408e9f62f8d57da Mon Sep 17 00:00:00 2001 From: Fekete Mihai Date: Sat, 17 Mar 2018 07:18:58 +0200 Subject: [PATCH] Migrate account_fiscal_month. Update tests for unlink. Update tests. Update unlin ktest in super. --- account_fiscal_month/README.rst | 21 ++++++++----------- account_fiscal_month/__manifest__.py | 3 +-- .../models/date_range_type.py | 2 -- account_fiscal_month/models/res_company.py | 1 - .../tests/test_account_fiscal_month.py | 20 +++++++++++++++++- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/account_fiscal_month/README.rst b/account_fiscal_month/README.rst index 8f95ad69..38260b74 100644 --- a/account_fiscal_month/README.rst +++ b/account_fiscal_month/README.rst @@ -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 `_. 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 `_. +* Odoo Community Association: `Icon `_. Contributors ------------ diff --git a/account_fiscal_month/__manifest__.py b/account_fiscal_month/__manifest__.py index c8fac9ff..70738cb2 100644 --- a/account_fiscal_month/__manifest__.py +++ b/account_fiscal_month/__manifest__.py @@ -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', diff --git a/account_fiscal_month/models/date_range_type.py b/account_fiscal_month/models/date_range_type.py index 03ea690c..7c3c23f1 100644 --- a/account_fiscal_month/models/date_range_type.py +++ b/account_fiscal_month/models/date_range_type.py @@ -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) diff --git a/account_fiscal_month/models/res_company.py b/account_fiscal_month/models/res_company.py index d58531da..bbeddc8f 100644 --- a/account_fiscal_month/models/res_company.py +++ b/account_fiscal_month/models/res_company.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/account_fiscal_month/tests/test_account_fiscal_month.py b/account_fiscal_month/tests/test_account_fiscal_month.py index 4ab5c070..dc5f8d53 100644 --- a/account_fiscal_month/tests/test_account_fiscal_month.py +++ b/account_fiscal_month/tests/test_account_fiscal_month.py @@ -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()