|
|
@ -1,5 +1,5 @@ |
|
|
|
# © 2016 ACSONE SA/NV (<http://acsone.eu>) |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)nses/agpl). |
|
|
|
# © 2016 ACSONE SA/NV (<https://acsone.eu>) |
|
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)nses/agpl). |
|
|
|
|
|
|
|
from odoo.tests.common import TransactionCase |
|
|
|
from odoo.exceptions import ValidationError |
|
|
@ -73,3 +73,41 @@ class DateRangeGeneratorTest(TransactionCase): |
|
|
|
'count': 4, |
|
|
|
'company_id': self.company_2.id, |
|
|
|
}) |
|
|
|
|
|
|
|
def test_generator_partner_id_domain(self): |
|
|
|
"""Check here domain returned for partner_id |
|
|
|
in both date.range and date.range.generator""" |
|
|
|
date_range = self.env['date.range'] |
|
|
|
generator = self.env['date.range.generator'] |
|
|
|
date_type = self.env['date.range.type'] |
|
|
|
month_type = date_type.create({ |
|
|
|
'name': 'month type' |
|
|
|
}) |
|
|
|
day_type = date_type.create({ |
|
|
|
'name': 'day type', |
|
|
|
'parent_type_id': month_type.id, |
|
|
|
}) |
|
|
|
month_range = date_range.create({ |
|
|
|
'name': 'month range', |
|
|
|
'type_id': month_type.id, |
|
|
|
'date_start': '01-01-2050', |
|
|
|
'date_end': '02-01-2050', |
|
|
|
}) |
|
|
|
# now trigger onchange in generator, |
|
|
|
# which would also trigger onchange in date_range |
|
|
|
values = { |
|
|
|
'date_start': month_range.date_start, |
|
|
|
'type_id': day_type.id, |
|
|
|
} |
|
|
|
on_change = generator._onchange_spec() |
|
|
|
domain = generator.onchange( |
|
|
|
values, |
|
|
|
['type_id', 'date_start'], |
|
|
|
on_change, |
|
|
|
) |
|
|
|
# check that with this search domain, |
|
|
|
# only the month_range record is returned. |
|
|
|
self.assertEqual( |
|
|
|
date_range.search(domain['domain']['parent_id']), |
|
|
|
month_range, |
|
|
|
) |