Skip to content

Commit

Permalink
feat: restore season
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencabrera committed Mar 7, 2024
1 parent 3a4f610 commit 435a5fc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
7 changes: 4 additions & 3 deletions partner_portal_extra_details/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
"l10n_es",
],
"data": [
#datas
# datas
"data/product_template_data.xml",
"data/mail_template_data.xml",
"data/ir_cron_data.xml",
"data/season_start_cron.xml",
#views
"data/restore_season_confirmation_cron.xml",
# views
"views/portal_templates.xml",
"views/res_partner.xml",
"views/res_company_views.xml",
#wizard
# wizard
"wizard/automatic_partner_invoice.xml",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- En fase de desarrollo aún, dejamos que se actualice -->
<!-- <data noupdate="1"> -->
<record id="ir_cron_season_start" model="ir.cron">
<field name="name">Restaura participación en temporada</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="state">code</field>
<field name="code">model.restore_current_year_confirmation()</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">12</field>
<field name="interval_type">months</field>
<field name="numbercall">-1</field>
<field eval="True" name="doall"/>
<field name="priority">10</field>
<field name="nextcall">2025-02-01 10:10:10</field>
</record>
</data>
</odoo>
13 changes: 11 additions & 2 deletions partner_portal_extra_details/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ def restore_current_year_confirmation(self):
"""
Restaurar la confirmación de participación del presente año.
"""
pass
players = self._filter_players()
_logger.debug("Restaurando temporada para todos los jugadores")
players.write(
{
"attach_receipt": False,
"current_year_confirmed": False,
"valid_receipt": False,
}
)

def has_invoice_this_year(self, partner_id):
account_invoice = invoices = self.env['account.invoice']
Expand Down Expand Up @@ -151,7 +159,6 @@ def _send_mail_to_new_validate_user(self):
enviarse una vez, no cada año, pero lo usamos en 2022 como correo
de inicio de temporada.
"""
# self.ensure_one()
for partner in self:
if not self.has_invoice_this_year(partner.id):
invoice = partner._create_partner_invoice()
Expand All @@ -165,7 +172,9 @@ def _filter_players(self):
"""
return self.search(
[
'&',
('is_player', '=', True),
('active', '=', True),
]
)

Expand Down

0 comments on commit 435a5fc

Please sign in to comment.