Skip to content

Commit

Permalink
[MIG] crm_event: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-tecnativa committed Jan 23, 2023
1 parent 9d3ad8b commit c589951
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 40 deletions.
2 changes: 1 addition & 1 deletion crm_event/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "CRM Event Category",
"summary": "Link opportunities to event categories",
"version": "13.0.1.1.0",
"version": "15.0.1.0.0",
"development_status": "Production/Stable",
"category": "Event Management",
"website": "https://github.com/OCA/event",
Expand Down
13 changes: 11 additions & 2 deletions crm_event/i18n/crm_event.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-23 09:29+0000\n"
"PO-Revision-Date: 2023-01-23 09:29+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.crm_case_kanban_view_leads
msgid "<i class=\"fa fa-ticket\" title=\"Ticket\"/>"
msgstr ""

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__events_available_count
msgid "Available events count"
Expand Down Expand Up @@ -45,7 +52,7 @@ msgstr ""

#. module: crm_event
#: model:ir.model,name:crm_event.model_event_type
msgid "Event Category"
msgid "Event Template"
msgstr ""

#. module: crm_event
Expand Down Expand Up @@ -203,7 +210,9 @@ msgid "Total seats wanted"
msgstr ""

#. module: crm_event
#: code:addons/crm_event/models/event_type.py:0
#: model:ir.model.fields.selection,name:crm_event.selection__event_type_report__event_seats_availability__unlimited
#, python-format
msgid "Unlimited"
msgstr ""

Expand Down
189 changes: 176 additions & 13 deletions crm_event/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,46 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-10 12:25+0000\n"
"PO-Revision-Date: 2021-02-10 12:26+0000\n"
"POT-Creation-Date: 2023-01-23 09:29+0000\n"
"PO-Revision-Date: 2023-01-23 10:47+0100\n"
"Last-Translator: Jairo Llopis <jairo.llopis@tecnativa.com>\n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.4.2\n"
"X-Generator: Poedit 3.0.1\n"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.crm_case_kanban_view_leads
msgid "<i class=\"fa fa-ticket\" title=\"Ticket\"/>"
msgstr ""

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__events_available_count
msgid "Available events count"
msgstr "Recuento de eventos disponibles"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__seats_limited_available
msgid "Available seats in limited events"
msgstr "Plazas disponibles en eventos limitados"

#. module: crm_event
#: model:ir.ui.menu,name:crm_event.menu_event_type_report
msgid "Categories"
msgstr "Categorías"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__name
msgid "Category name"
msgstr "Nombre de categoría"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.crm_opportunity_report_view_search
Expand All @@ -24,59 +54,149 @@ msgstr "Evento"

#. module: crm_event
#: model:ir.model,name:crm_event.model_event_type
msgid "Event Category"
#, fuzzy
#| msgid "Event Category"
msgid "Event Template"
msgstr "Categoría de eventos"

#. module: crm_event
#: model:ir.model,name:crm_event.model_event_type_report
#, fuzzy
#| msgid "Event category"
msgid "Event categories analysis report"
msgstr "Categoría de evento"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_crm_lead__event_type_id
msgid "Event category"
msgstr "Categoría de evento"

#. module: crm_event
#: model:ir.actions.act_window,name:crm_event.action_event_type_report
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_graph
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_pivot
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_search
#, fuzzy
#| msgid "Event category"
msgid "Event category analysis"
msgstr "Categoría de evento"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_search
msgid "Event seats availability"
msgstr "Disponibilidad de plazas del evento"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.crm_opportunity_report_view_search
#: model_terms:ir.ui.view,arch_db:crm_event.view_crm_case_leads_filter
#: model_terms:ir.ui.view,arch_db:crm_event.view_crm_case_opportunities_filter
msgid "Event category"
msgstr "Categoría de evento"
#, fuzzy
#| msgid "Event Category"
msgid "Event type"
msgstr "Categoría de eventos"

#. module: crm_event
#: code:addons/crm_event/models/event_type.py:94
#: code:addons/crm_event/models/event_type.py:0
#, python-format
msgid "Events"
msgstr "Eventos"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type__seats_available_total
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_form
msgid "Events (seats)"
msgstr "Eventos (plazas)"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type__seats_available_total
#, fuzzy
#| msgid "Events (seats)"
msgid "Events available (and seats)"
msgstr "Eventos (plazas)"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_search
msgid "Extended Filters"
msgstr "Filtros extendidos..."

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_search
msgid "Group By"
msgstr "Agrupar por"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__id
msgid "ID"
msgstr "Identificación"

#. module: crm_event
#: model:ir.model.fields,help:crm_event.field_crm_lead__seats_wanted
msgid ""
"If this lead/opportunity is related to a specific event category, indicate how "
"many seats would you sell if won."
"If this lead/opportunity is related to a specific event category, indicate "
"how many seats would you sell if won."
msgstr ""
"Si esta iniciativa u oportunidad está relacionada con una categoría "
"específica de evento, indique cuántas plazas vendería si se gana."

#. module: crm_event
#: model:ir.model.fields,help:crm_event.field_crm_lead__event_type_id
msgid ""
"If this lead/opportunity is related to a specific event category, indicate it "
"here."
"If this lead/opportunity is related to a specific event category, indicate "
"it here."
msgstr ""
"Si esta iniciativa u oportunidad está relacionada con una categoría "
"específica de evento, indíquelo aquí."

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report____last_update
msgid "Last Modified on"
msgstr "Última modificación el"

#. module: crm_event
#: model:ir.model,name:crm_event.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Iniciativa/Oportunidad"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type__crm_lead_ids
#, fuzzy
#| msgid "Lead/Opportunity"
msgid "Leads/Opportunities"
msgstr "Iniciativa/Oportunidad"

#. module: crm_event
#: model:ir.model.fields.selection,name:crm_event.selection__event_type_report__event_seats_availability__limited
msgid "Limited"
msgstr "Limitado"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_search
msgid "Limited events"
msgstr "Eventos limitados"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type__open_opportunities_count
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__open_opportunities_count
#, fuzzy
#| msgid "Opportunities"
msgid "Open Opportunities Count"
msgstr "Oportunidades"

#. module: crm_event
#: model:ir.model.fields,help:crm_event.field_event_type__seats_wanted_total
msgid "Open opportunities for events of this category (and wanted seats)."
msgstr ""
"Oportunidades abiertas para eventos de esta categoría (y plazas deseadas)."

#. module: crm_event
#: code:addons/crm_event/models/event_type.py:109
#: model:ir.model.fields,help:crm_event.field_event_type__open_opportunities_count
#, fuzzy
#| msgid "Open opportunities for events of this category (and wanted seats)."
msgid "Open opportunities for events of this category."
msgstr ""
"Oportunidades abiertas para eventos de esta categoría (y plazas deseadas)."

#. module: crm_event
#: code:addons/crm_event/models/event_type.py:0
#, python-format
msgid "Opportunities"
msgstr "Oportunidades"
Expand All @@ -86,17 +206,60 @@ msgstr "Oportunidades"
msgid "Opportunities (seats)"
msgstr "Oportunidades (plazas)"

#. module: crm_event
#: model_terms:ir.actions.act_window,help:crm_event.action_event_type_report
msgid ""
"Report to analyze interest and status of event categories, taking into "
"account upcoming or running events and potential sale information."
msgstr ""
"Informe para analizar el interés y el estado de las categorías de eventos, "
"teniendo en cuenta los eventos próximos o en curso y la información sobre "
"ventas potenciales."

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_crm_lead__seats_wanted
msgid "Seats Wanted"
msgstr "Plazas deseadas"

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__event_seats_availability
msgid "Seats availability"
msgstr "Disponibilidad de plazas"

#. module: crm_event
#: model:ir.model.fields,help:crm_event.field_event_type__seats_wanted_sum
#, fuzzy
#| msgid "Open opportunities for events of this category (and wanted seats)."
msgid "Sum of wanted seats in opportunities for events of this category."
msgstr ""
"Oportunidades abiertas para eventos de esta categoría (y plazas deseadas)."

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.crm_case_tree_view_oppor
msgid "Total seats wanted"
msgstr "Total de plazas deseadas"

#. module: crm_event
#: code:addons/crm_event/models/event_type.py:0
#: model:ir.model.fields.selection,name:crm_event.selection__event_type_report__event_seats_availability__unlimited
#, python-format
msgid "Unlimited"
msgstr "Ilimitado"

#. module: crm_event
#: model_terms:ir.ui.view,arch_db:crm_event.view_event_type_report_search
msgid "Unlimited events"
msgstr "Eventos ilimitados"

#. module: crm_event
#: model:ir.model.fields,help:crm_event.field_event_type__seats_available_total
msgid "Upcoming/running events of this category (and available seats)."
msgstr "Eventos próximos/en marcha de esta categoría (y plazas disponibles)."

#. module: crm_event
#: model:ir.model.fields,field_description:crm_event.field_event_type__seats_wanted_sum
#: model:ir.model.fields,field_description:crm_event.field_event_type_report__seats_wanted
#, fuzzy
#| msgid "Events (seats)"
msgid "Wanted seats"
msgstr "Eventos (plazas)"
10 changes: 2 additions & 8 deletions crm_event/models/event_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def _events_domain(self):
# events when clicking on it, so it seems more user-friendly to
# include these events, even if they finished earlier today.
("date_end", ">=", fields.Date.today()),
("state", "!=", "cancel"),
]

def _compute_event_totals(self):
Expand All @@ -56,7 +55,7 @@ def _compute_event_totals(self):
types_with_unlimited_seats = (
self.env["event.event"]
.search(
domain + [("seats_availability", "=", "unlimited")],
domain + [("seats_limited", "=", False)],
)
.mapped("event_type_id")
)
Expand All @@ -65,17 +64,12 @@ def _compute_event_totals(self):
fields=["seats_available"],
groupby=["event_type_id"],
)
translated_unlimited = dict(
self.env["event.event"].fields_get(["seats_availability"])[
"seats_availability"
]["selection"]
)["unlimited"]
totals = {group["event_type_id"][0]: group for group in results}
for one in self:
totals_item = totals.get(one.id, {})
event_count = totals_item.get("event_type_id_count", 0)
seats_sum = (
translated_unlimited
_("Unlimited")
if one in types_with_unlimited_seats
else totals_item.get("seats_available", "0")
)
Expand Down
5 changes: 4 additions & 1 deletion crm_event/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* Jairo Llopis <jairo.llopis@tecnativa.com> (https://www.tecnativa.com/)
* `Tecnativa <https://www.tecnativa.com>`__:

* Jairo Llopis
* Stefan Ungureanu
11 changes: 4 additions & 7 deletions crm_event/reports/event_type_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def _select(self, fields_=()):
("events_available_count", "COUNT(ee.*)"),
(
"event_seats_availability",
"""CASE WHEN 'unlimited' = ANY(ARRAY_AGG(seats_availability))
THEN 'unlimited' ELSE 'limited' END""",
"""CASE WHEN ee.seats_limited
THEN 'limited' ELSE 'unlimited' END""",
),
("seats_limited_available", "COALESCE(SUM(ee.seats_available), 0)"),
("open_opportunities_count", "et.open_opportunities_count"),
Expand Down Expand Up @@ -80,10 +80,7 @@ def _where(self, clauses=()):
Arguments:
clauses: `("mt.field >= 10 OR mt.field < 0", ...)`
"""
clauses += (
"ee.state IS NULL OR ee.state != 'cancel'",
"ee.date_end IS NULL OR ee.date_end >= CURRENT_DATE",
)
clauses += ("ee.date_end IS NULL OR ee.date_end >= CURRENT_DATE",)
result = sql.Composed(map(sql.SQL, clauses)).join(" AND ")
return result

Expand All @@ -93,7 +90,7 @@ def _groupby(self, clauses=()):
Arguments:
clauses: `("mt.field", ...)`
"""
clauses += ("et.id",)
clauses += ("et.id", "ee.seats_limited")
result = sql.Composed(map(sql.SQL, clauses)).join(", ")
return result

Expand Down
Loading

0 comments on commit c589951

Please sign in to comment.