diff --git a/event_sale_reservation/README.rst b/event_sale_reservation/README.rst index 918e050ca..a72b7d24e 100644 --- a/event_sale_reservation/README.rst +++ b/event_sale_reservation/README.rst @@ -38,15 +38,6 @@ exist. .. contents:: :local: -Installation -============ - -To install this module, you need to: - -1. Install ``web_ir_actions_act_multi`` from https://github.com/OCA/web -2. Install ``web_ir_actions_act_view_reload`` from - https://github.com/OCA/web - Configuration ============= @@ -152,6 +143,7 @@ Contributors - `Tecnativa `__: - Jairo Llopis + - Pilar Vargas Maintainers ----------- @@ -166,13 +158,13 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -.. |maintainer-Yajo| image:: https://github.com/Yajo.png?size=40px - :target: https://github.com/Yajo - :alt: Yajo +.. |maintainer-pilarvargas-tecnativa| image:: https://github.com/pilarvargas-tecnativa.png?size=40px + :target: https://github.com/pilarvargas-tecnativa + :alt: pilarvargas-tecnativa Current `maintainer `__: -|maintainer-Yajo| +|maintainer-pilarvargas-tecnativa| This module is part of the `OCA/event `_ project on GitHub. diff --git a/event_sale_reservation/__manifest__.py b/event_sale_reservation/__manifest__.py index d9ca97f89..56ad8a529 100644 --- a/event_sale_reservation/__manifest__.py +++ b/event_sale_reservation/__manifest__.py @@ -4,19 +4,17 @@ { "name": "Sell event reservations", "summary": "Allow selling event registrations before the event exists", - "version": "15.0.1.0.0", + "version": "17.0.1.0.0", "development_status": "Beta", "category": "Marketing", "website": "https://github.com/OCA/event", "author": "Tecnativa, Odoo Community Association (OCA)", - "maintainers": ["Yajo"], + "maintainers": ["pilarvargas-tecnativa"], "license": "AGPL-3", "application": False, "installable": True, "depends": [ "event_sale", - "web_ir_actions_act_multi", - "web_ir_actions_act_view_reload", ], "data": [ "reports/sale_report_view.xml", diff --git a/event_sale_reservation/i18n/es.po b/event_sale_reservation/i18n/es.po index d7f41ba29..1b612cc63 100644 --- a/event_sale_reservation/i18n/es.po +++ b/event_sale_reservation/i18n/es.po @@ -81,8 +81,8 @@ msgstr "Categoría de evento de la reserva" #. module: event_sale_reservation #: model:ir.model.fields.selection,name:event_sale_reservation.selection__product_template__detailed_type__event_reservation -msgid "Event Resevation" -msgstr "Reseva de Evento" +msgid "Event Reservation" +msgstr "Reserva de Evento" #. module: event_sale_reservation #: model:ir.model,name:event_sale_reservation.model_event_type diff --git a/event_sale_reservation/i18n/event_sale_reservation.pot b/event_sale_reservation/i18n/event_sale_reservation.pot index 76baa653f..d5ba7a166 100644 --- a/event_sale_reservation/i18n/event_sale_reservation.pot +++ b/event_sale_reservation/i18n/event_sale_reservation.pot @@ -70,7 +70,7 @@ msgstr "" #. module: event_sale_reservation #: model:ir.model.fields.selection,name:event_sale_reservation.selection__product_template__detailed_type__event_reservation -msgid "Event Resevation" +msgid "Event Reservation" msgstr "" #. module: event_sale_reservation diff --git a/event_sale_reservation/i18n/it.po b/event_sale_reservation/i18n/it.po index ec8d25e66..cc0f9d4d7 100644 --- a/event_sale_reservation/i18n/it.po +++ b/event_sale_reservation/i18n/it.po @@ -80,7 +80,7 @@ msgstr "Tipo prenotazione evento" #. module: event_sale_reservation #: model:ir.model.fields.selection,name:event_sale_reservation.selection__product_template__detailed_type__event_reservation -msgid "Event Resevation" +msgid "Event Reservation" msgstr "Prenotazione evento" #. module: event_sale_reservation diff --git a/event_sale_reservation/migrations/15.0.1.0.0/post-migration.py b/event_sale_reservation/migrations/15.0.1.0.0/post-migration.py deleted file mode 100644 index 1d0148ae4..000000000 --- a/event_sale_reservation/migrations/15.0.1.0.0/post-migration.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2023 Tecnativa - Víctor Martínez -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - openupgrade.logged_query( - env.cr, - """UPDATE product_template SET detailed_type = 'event_reservation' - WHERE event_reservation_ok IS TRUE""", - ) diff --git a/event_sale_reservation/models/product_template.py b/event_sale_reservation/models/product_template.py index 11abede4e..984fa8860 100644 --- a/event_sale_reservation/models/product_template.py +++ b/event_sale_reservation/models/product_template.py @@ -12,7 +12,7 @@ class ProductTemplate(models.Model): detailed_type = fields.Selection( selection_add=[ - ("event_reservation", "Event Resevation"), + ("event_reservation", "Event Reservation"), ], ondelete={"event_reservation": "set service"}, ) diff --git a/event_sale_reservation/readme/CONTRIBUTORS.md b/event_sale_reservation/readme/CONTRIBUTORS.md index 0ca814b0e..8fbb51548 100644 --- a/event_sale_reservation/readme/CONTRIBUTORS.md +++ b/event_sale_reservation/readme/CONTRIBUTORS.md @@ -1,2 +1,3 @@ - [Tecnativa](https://www.tecnativa.com): - Jairo Llopis + - Pilar Vargas diff --git a/event_sale_reservation/readme/INSTALL.md b/event_sale_reservation/readme/INSTALL.md deleted file mode 100644 index 8ddf2472a..000000000 --- a/event_sale_reservation/readme/INSTALL.md +++ /dev/null @@ -1,5 +0,0 @@ -To install this module, you need to: - -1. Install `web_ir_actions_act_multi` from -2. Install `web_ir_actions_act_view_reload` from - diff --git a/event_sale_reservation/reports/sale_report.py b/event_sale_reservation/reports/sale_report.py index 13815fb47..5a5a74a23 100644 --- a/event_sale_reservation/reports/sale_report.py +++ b/event_sale_reservation/reports/sale_report.py @@ -13,17 +13,12 @@ class SaleReport(models.Model): string="Event reservation type", ) - def _query(self, with_clause="", fields=None, groupby="", from_clause=""): - if fields is None: - fields = {} - select_str = """ , - t.event_reservation_type_id as event_reservation_type_id - """ - fields.update({"event_reservation_type_id": select_str}) - groupby += ", t.event_reservation_type_id" - return super()._query( - with_clause=with_clause, - fields=fields, - groupby=groupby, - from_clause=from_clause, - ) + def _select_additional_fields(self): + res = super()._select_additional_fields() + res["event_reservation_type_id"] = "t.event_reservation_type_id" + return res + + def _group_by_sale(self): + res = super()._group_by_sale() + res += """, t.event_reservation_type_id""" + return res diff --git a/event_sale_reservation/reports/sale_report_view.xml b/event_sale_reservation/reports/sale_report_view.xml index 474ab40dd..cd06a7b7b 100644 --- a/event_sale_reservation/reports/sale_report_view.xml +++ b/event_sale_reservation/reports/sale_report_view.xml @@ -7,7 +7,7 @@ sale.report - + Sell event reservations

Table of contents

-
-

Installation

-

To install this module, you need to:

-
    -
  1. Install web_ir_actions_act_multi from https://github.com/OCA/web
  2. -
  3. Install web_ir_actions_act_view_reload from -https://github.com/OCA/web
  4. -
-
-

Configuration

+

Configuration

To make use of this module, a user needs these minimal permissions:

  • Sales / User: Own Documents Only
  • @@ -408,7 +398,7 @@

    Configuration

-

Usage

+

Usage

To know how many reservations exist for a given event type:

  1. Go to Events > Configuration > Event Templates and pick or create @@ -468,14 +458,14 @@

    Usage

    event_sale module in action.

-

Known issues / Roadmap

+

Known issues / Roadmap

Some addons (event_registration_multi_qty + event_sale_registration_multi_qty) makes totals wrong because they depend currently on count and not sum of qtys; integrating with them would require a glue module.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -483,24 +473,25 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Tecnativa
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -509,7 +500,7 @@

Maintainers

mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

-

Yajo

+

pilarvargas-tecnativa

This module is part of the OCA/event project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/event_sale_reservation/tests/test_event_sale.py b/event_sale_reservation/tests/test_event_sale.py index 72da43949..1beb91040 100644 --- a/event_sale_reservation/tests/test_event_sale.py +++ b/event_sale_reservation/tests/test_event_sale.py @@ -3,12 +3,14 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from datetime import datetime, timedelta -from odoo.tests.common import Form, TransactionCase +from odoo.tests.common import Form + +from odoo.addons.base.tests.common import BaseCommon from ..exceptions import ReservationWithoutEventTypeError -class EventSaleCase(TransactionCase): +class EventSaleCase(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() @@ -91,14 +93,14 @@ def wizard_reservation_to_registration(self, order): def wizard_step_2(self, wizard1): """Generate a step 2 wizard from the step 1 wizard.""" - multi_action = wizard1.action_convert_to_registration() - # Ensure we first close the first wizard - self.assertEqual(multi_action["type"], "ir.actions.act_multi") - self.assertEqual( - multi_action["actions"][0]["type"], "ir.actions.act_window_close" - ) + action = wizard1.action_convert_to_registration() + # Verify that the action type is open a window + self.assertEqual(action["type"], "ir.actions.act_window") + # Verify the model and context of the wizard + self.assertEqual(action["res_model"], wizard1._name) + self.assertIn("skip_event_sale_registration_multi_qty", action["context"]) + self.assertFalse(action["context"]["registering_reservations"]) # Get form from 2nd chained action - action = multi_action["actions"][1] return Form( self.env[action["res_model"]].with_context(**action["context"]), view=action["view_id"], @@ -118,7 +120,7 @@ def test_wrong_product_reservation_without_type(self): def test_event_type_open_orders(self): """Test the smart button that opens orders from an event type.""" self.orders.action_confirm() - groups = zip(self.event_types, self.orders, (1, 10, 100)) + groups = zip(self.event_types, self.orders, (1, 10, 100), strict=True) for ev_type, so, reservations in groups: self.assertEqual(ev_type.seats_reservation_total, reservations) action = ev_type.action_open_sale_orders() @@ -127,12 +129,12 @@ def test_event_type_open_orders(self): def test_sale_workflow(self): # Start: orders are draft, all is pending, nothing is reserved - self.orders.invalidate_cache(["event_reservations_pending"]) + self.orders.invalidate_recordset(["event_reservations_pending"]) self.assertEqual(self.orders.mapped("event_reservations_pending"), [1, 10, 100]) self.assertEqual(self.event_types.mapped("seats_reservation_total"), [0, 0, 0]) # Confirm orders: all is pending, all is reserved self.orders.action_confirm() - self.orders.invalidate_cache(["event_reservations_pending"]) + self.orders.invalidate_recordset(["event_reservations_pending"]) self.assertEqual(self.orders.mapped("event_reservations_pending"), [1, 10, 100]) self.assertEqual( self.event_types.mapped("seats_reservation_total"), [1, 10, 100] @@ -155,7 +157,7 @@ def test_sale_workflow(self): wiz2_line.save() wiz2.save().action_make_registration() # 1st and 3rd SO are pending and reserved - self.orders.invalidate_cache(["event_reservations_pending"]) + self.orders.invalidate_recordset(["event_reservations_pending"]) self.assertEqual(self.orders.mapped("event_reservations_pending"), [1, 0, 100]) self.assertEqual( self.event_types.mapped("seats_reservation_total"), [1, 0, 100] diff --git a/event_sale_reservation/views/event_type_view.xml b/event_sale_reservation/views/event_type_view.xml index 79b0e3f7b..0136450a1 100644 --- a/event_sale_reservation/views/event_type_view.xml +++ b/event_sale_reservation/views/event_type_view.xml @@ -5,14 +5,17 @@ Link to reservations from type event.type -
-
+
@@ -23,14 +23,14 @@ type="object" class="oe_stat_button" icon="fa-users" - attrs="{'invisible': [('event_registration_count', '=', 0)]}" + invisible="event_registration_count == 0" >
diff --git a/event_sale_reservation/wizards/registration_editor.py b/event_sale_reservation/wizards/registration_editor.py index 5edbd5473..57cb102cc 100644 --- a/event_sale_reservation/wizards/registration_editor.py +++ b/event_sale_reservation/wizards/registration_editor.py @@ -42,34 +42,21 @@ def action_convert_to_registration(self): "event_id": line.event_id.id, "event_ticket_id": line.event_ticket_id.id, "product_id": line.event_ticket_id.product_id.id, + "price_unit": line.sale_order_line_id.price_unit, } ) # Close current wizard and reopen normally to configure registrations upstream_view = self.env.ref("event_sale.view_event_registration_editor_form") return { - "type": "ir.actions.act_multi", - "actions": [ - {"type": "ir.actions.act_window_close"}, - { - "context": dict( - self.env.context, - registering_reservations=False, - skip_event_sale_registration_multi_qty=True, - ), - "res_model": self._name, - "target": "new", - "type": "ir.actions.act_window", - "view_id": upstream_view.id, - "view_mode": "form", - "views": [[upstream_view.id, "form"]], - }, - ], - } - - def action_make_registration(self): - """Force main view reload after finishing.""" - result = super().action_make_registration() - return { - "type": "ir.actions.act_multi", - "actions": [result, {"type": "ir.actions.act_view_reload"}], + "type": "ir.actions.act_window", + "context": dict( + self.env.context, + registering_reservations=False, + skip_event_sale_registration_multi_qty=True, + ), + "res_model": self._name, + "target": "new", + "view_id": upstream_view.id, + "view_mode": "form", + "views": [[upstream_view.id, "form"]], } diff --git a/event_sale_reservation/wizards/registration_editor_view.xml b/event_sale_reservation/wizards/registration_editor_view.xml index c39381dd0..07981e4ac 100644 --- a/event_sale_reservation/wizards/registration_editor_view.xml +++ b/event_sale_reservation/wizards/registration_editor_view.xml @@ -8,21 +8,19 @@ registration.editor
- -

- Convert pending event reservations into registrations for - -

-

- If there is any line from that order that you still do - not want to convert into real event registrations, you - can remove it from the list below. You will be able to - repeat this process later for those lines. -

-
+

+ Convert pending event reservations into registrations for + +

+

+ If there is any line from that order that you still do + not want to convert into real event registrations, you + can remove it from the list below. You will be able to + repeat this process later for those lines. +

- +