mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #646 from acsone/10.0-fix-account_fiscal_year_search-dro
[10.0][FIX] account_move_fiscal_month/year: Wrong search result
This commit is contained in:
@@ -30,6 +30,8 @@ class AccountMove(models.Model):
|
||||
date_range_domain = [('name', operator, value)]
|
||||
|
||||
date_ranges = self.env['date.range'].search(date_range_domain)
|
||||
if not date_ranges:
|
||||
return [('id', '=', False)]
|
||||
domain = []
|
||||
for date_range in date_ranges:
|
||||
domain = expression.OR([domain, [
|
||||
|
||||
@@ -154,3 +154,10 @@ class TestAccountMoveFiscalMonth(TransactionCase):
|
||||
move_march_2017 not in moves,
|
||||
move_jan_2018 not in moves,
|
||||
]))
|
||||
# Search non existing month
|
||||
moves = self.AccountMoveObj.search([
|
||||
('date_range_fm_id', 'ilike', '2016'),
|
||||
])
|
||||
self.assertFalse(
|
||||
moves
|
||||
)
|
||||
|
||||
@@ -40,6 +40,9 @@ class AccountMove(models.Model):
|
||||
date_range_domain.append(('type_id', '=', fiscal_year_type.id))
|
||||
date_ranges = self.env['date.range'].search(date_range_domain)
|
||||
|
||||
if not date_ranges:
|
||||
return [('id', '=', False)]
|
||||
|
||||
domain = []
|
||||
for date_range in date_ranges:
|
||||
domain = expression.OR([domain, [
|
||||
|
||||
@@ -131,3 +131,10 @@ class TestAccountMoveFiscalYear(TransactionCase):
|
||||
move_2018 in moves,
|
||||
move_2019 not in moves,
|
||||
]))
|
||||
# Search non existing year
|
||||
moves = self.AccountMoveObj.search([
|
||||
('date_range_fy_id', 'ilike', '2016'),
|
||||
])
|
||||
self.assertFalse(
|
||||
moves
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user