Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions child_compassion/views/global_childpool_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@
type="object"
class="oe_highlight"
style="margin-left: 5px"
/>
<button
name="do_365_mix"
string="365 children"
type="object"
class="oe_highlight"
style="margin-left: 5px"
/>
<button
name="filter"
Expand Down Expand Up @@ -181,14 +174,6 @@
<div invisible="not nb_found">
<p style="color:red">A filter is active</p>
</div>
<div invisible="not missing_dates">
<p style="color:red">Missing birthdates</p>
<field
name="missing_dates"
style="color: red"
readonly="1"
/>
</div>
<separator />
<field name="global_child_ids" invisible="True" />
<label for="global_child_ids" />
Expand Down
46 changes: 0 additions & 46 deletions child_compassion/wizards/global_child_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from datetime import date, datetime, timedelta
from math import ceil

from dateutil.relativedelta import relativedelta

from odoo import _, api, fields, models
from odoo.exceptions import UserError

Expand Down Expand Up @@ -122,7 +120,6 @@ class GlobalChildSearch(models.TransientModel):
help="These children were removed from the search results because "
"of a National Office restriction configuration.",
)
missing_dates = fields.Text(help="All birthdates not found when using 365 search")

##########################################################################
# FIELDS METHODS #
Expand Down Expand Up @@ -308,49 +305,6 @@ def country_mix(self):
(self.global_child_ids - found_children).unlink()
return True

def do_365_mix(self):
"""Try to find one child per day of the year having his birthdate
on that date."""
today = date.today()
first_day = today.replace(day=1, month=1)
last_day = today.replace(day=31, month=12)
current_date = first_day
# First step as regular search
self.write(
{
"birthday_day": 1,
"birthday_month": 1,
"take": 1,
"missing_dates": "",
"skip": 0,
}
)
self.do_search()
while current_date < last_day:
# Next steps: add child to the search result
current_date += relativedelta(days=1)
self.write(
{
"birthday_day": current_date.day,
"birthday_month": current_date.month,
"skip": 0,
}
)
try:
self.add_search()
except UserError:
# No children found on that date: displays it.
self.missing_dates += current_date.strftime("%d.%m\n")

# Reset search criteria
self.write(
{
"birthday_day": 0,
"birthday_month": 0,
"take": 80,
}
)

def filter(self):
self.ensure_one()
matching = self.global_child_ids.filtered(lambda child: self._does_match(child))
Expand Down
Loading