Browse Source

DO NOT MERGE add test module removing constrains on date_range

pull/34/head
Laurent Mignon (ACSONE) 6 years ago
parent
commit
4402ce7419
  1. 22
      date_range_child/README.rst
  2. 1
      date_range_child/__init__.py
  3. 17
      date_range_child/__manifest__.py
  4. 1
      date_range_child/models/__init__.py
  5. 13
      date_range_child/models/date_range.py
  6. 3
      date_range_child/tests/__init__.py
  7. 41
      date_range_child/tests/test_date_range.py

22
date_range_child/README.rst

@ -0,0 +1,22 @@
**This file is going to be generated by oca-gen-addon-readme.**
*Manual changes will be overwritten.*
Please provide content in the ``readme`` directory:
* **DESCRIPTION.rst** (required)
* INSTALL.rst (optional)
* CONFIGURE.rst (optional)
* **USAGE.rst** (optional, highly recommended)
* DEVELOP.rst (optional)
* ROADMAP.rst (optional)
* HISTORY.rst (optional, recommended)
* **CONTRIBUTORS.rst** (optional, highly recommended)
* CREDITS.rst (optional)
Content of this README will also be drawn from the addon manifest,
from keys such as name, authors, maintainers, development_status,
and license.
A good, one sentence summary in the manifest is also highly recommended.

1
date_range_child/__init__.py

@ -0,0 +1 @@
from . import models

17
date_range_child/__manifest__.py

@ -0,0 +1,17 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Date Range Child',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV',
'website': 'https://acsone.eu/',
'depends': [
'date_range'
],
'data': [
],
'demo': [
],
}

1
date_range_child/models/__init__.py

@ -0,0 +1 @@
from . import date_range

13
date_range_child/models/date_range.py

@ -0,0 +1,13 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class DateRange(models.Model):
_inherit = 'date.range'
@api.constrains('type_id', 'date_start', 'date_end', 'company_id')
def _validate_range(self):
return True

3
date_range_child/tests/__init__.py

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_date_range

41
date_range_child/tests/test_date_range.py

@ -0,0 +1,41 @@
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo.tests.common import TransactionCase
class DateRangeTest(TransactionCase):
def setUp(self):
super(DateRangeTest, self).setUp()
self.date_range = self.env['date.range']
self.type = self.env['date.range.type'].create(
{'name': 'Fiscal year',
'company_id': False,
'allow_overlap': False})
self.company = self.env['res.company'].create({
'name': 'Test company',
})
self.company_2 = self.env['res.company'].create({
'name': 'Test company 2',
'parent_id': self.company.id,
})
self.typeB = self.env['date.range.type'].create(
{'name': 'Fiscal year B',
'company_id': self.company.id,
'allow_overlap': False})
def test_overlap_allowed(self):
self.date_range.create({
'name': 'FS2015',
'date_start': '2015-01-01',
'date_end': '2015-12-31',
'type_id': self.type.id,
})
self.date_range.create({
'name': 'FS2016',
'date_start': '2015-01-01',
'date_end': '2016-12-31',
'type_id': self.type.id,
})
Loading…
Cancel
Save