Skip to content

Commit e23e442

Browse files
[MIG] event_sale_reservation: Migration to 18.0
1 parent b6ac39f commit e23e442

12 files changed

Lines changed: 40 additions & 29 deletions

File tree

event_sale_reservation/README.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Sell event reservations
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github
20-
:target: https://github.com/OCA/event/tree/17.0/event_sale_reservation
20+
:target: https://github.com/OCA/event/tree/18.0/event_sale_reservation
2121
:alt: OCA/event
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/event-17-0/event-17-0-event_sale_reservation
23+
:target: https://translation.odoo-community.org/projects/event-18-0/event-18-0-event_sale_reservation
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/event&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/event&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -125,7 +125,7 @@ Bug Tracker
125125
Bugs are tracked on `GitHub Issues <https://github.com/OCA/event/issues>`_.
126126
In case of trouble, please check there if your issue has already been reported.
127127
If you spotted it first, help us to smash it by providing a detailed and welcomed
128-
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_sale_reservation%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
128+
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_sale_reservation%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
129129

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

@@ -145,6 +145,10 @@ Contributors
145145
- Jairo Llopis
146146
- Pilar Vargas
147147

148+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
149+
150+
- Bhavesh Heliconia
151+
148152
Maintainers
149153
-----------
150154

@@ -166,6 +170,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
166170

167171
|maintainer-pilarvargas-tecnativa|
168172

169-
This module is part of the `OCA/event <https://github.com/OCA/event/tree/17.0/event_sale_reservation>`_ project on GitHub.
173+
This module is part of the `OCA/event <https://github.com/OCA/event/tree/18.0/event_sale_reservation>`_ project on GitHub.
170174

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

event_sale_reservation/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Sell event reservations",
66
"summary": "Allow selling event registrations before the event exists",
7-
"version": "17.0.1.0.1",
7+
"version": "18.0.1.0.0",
88
"development_status": "Mature",
99
"category": "Marketing",
1010
"website": "https://github.com/OCA/event",
@@ -14,6 +14,7 @@
1414
"application": False,
1515
"installable": True,
1616
"depends": [
17+
"product",
1718
"event_sale",
1819
],
1920
"data": [

event_sale_reservation/models/event_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def _seats_reservation_domain(self):
2424
return [
2525
("event_reservation_type_id", "in", self.ids),
2626
("order_id.state", "in", ("sale", "done")),
27-
("product_id.detailed_type", "=", "event_reservation"),
27+
("product_id.type", "=", "event_reservation"),
2828
]
2929

3030
@api.depends(
3131
"reserved_sale_order_line_ids.event_registration_count",
3232
"reserved_sale_order_line_ids.event_reservation_type_id",
3333
"reserved_sale_order_line_ids.order_id.state",
34-
"reserved_sale_order_line_ids.product_id.detailed_type",
34+
"reserved_sale_order_line_ids.product_id.type",
3535
"reserved_sale_order_line_ids.product_uom_qty",
3636
)
3737
def _compute_reservations_total(self):

event_sale_reservation/models/product_template.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# Copyright 2023 Tecnativa - Víctor Martínez
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

5-
from odoo import _, api, fields, models
5+
from odoo import api, fields, models
66

77
from ..exceptions import ReservationWithoutEventTypeError
88

99

1010
class ProductTemplate(models.Model):
1111
_inherit = "product.template"
1212

13-
detailed_type = fields.Selection(
13+
type = fields.Selection(
1414
selection_add=[
1515
("event_reservation", "Event Reservation"),
1616
],
@@ -28,17 +28,17 @@ def _detailed_type_mapping(self):
2828
type_mapping["event_reservation"] = "service"
2929
return type_mapping
3030

31-
@api.constrains("detailed_type")
31+
@api.constrains("type")
3232
def _check_event_reservation(self):
3333
"""Event reservation products checks.
3434
3535
- A product cannot be both an event ticket and an event reservation.
3636
- An event reservation must have an event type attached.
3737
"""
3838
for one in self:
39-
if one.detailed_type != "event_reservation":
39+
if one.type != "event_reservation":
4040
continue
4141
if not one.event_reservation_type_id:
4242
raise ReservationWithoutEventTypeError(
43-
_("You must indicate event type for %(name)s.")
43+
self.env._("You must indicate event type for %(name)s.")
4444
)

event_sale_reservation/models/sale_order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _compute_event_reservations_pending(self):
2626
"""Know how many pending event reservations are linked to this SO."""
2727
for one in self:
2828
reservation_lines = one.order_line.filtered(
29-
lambda x: x.product_id.detailed_type == "event_reservation"
29+
lambda x: x.product_id.type == "event_reservation"
3030
)
3131
reserved = sum(reservation_lines.mapped("product_uom_qty"))
3232
registered = sum(reservation_lines.mapped("event_registration_count"))
@@ -47,5 +47,5 @@ def action_open_event_registrations(self):
4747
"name": _("Attendees"),
4848
"res_model": "event.registration",
4949
"type": "ir.actions.act_window",
50-
"view_mode": "tree,form,calendar,graph",
50+
"view_mode": "list,form,calendar,graph",
5151
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
- [Tecnativa](https://www.tecnativa.com):
22
- Jairo Llopis
33
- Pilar Vargas
4+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
5+
- Bhavesh Heliconia

event_sale_reservation/static/description/index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Sell event reservations</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:e23d10fe39515a6cb80887303de1d063a1499d06b4b00f70cd139646101d3a9c
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/event/tree/17.0/event_sale_reservation"><img alt="OCA/event" src="https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/event-17-0/event-17-0-event_sale_reservation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/event&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/event/tree/18.0/event_sale_reservation"><img alt="OCA/event" src="https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/event-18-0/event-18-0-event_sale_reservation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/event&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module extends the functionality of event_sale to support selling
374374
reservations of events that still don’t exist and to allow you to
375375
schedule the creation of events based on how many reservations already
@@ -469,7 +469,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
469469
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/event/issues">GitHub Issues</a>.
470470
In case of trouble, please check there if your issue has already been reported.
471471
If you spotted it first, help us to smash it by providing a detailed and welcomed
472-
<a class="reference external" href="https://github.com/OCA/event/issues/new?body=module:%20event_sale_reservation%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
472+
<a class="reference external" href="https://github.com/OCA/event/issues/new?body=module:%20event_sale_reservation%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
473473
<p>Do not contact contributors directly about support or help with technical issues.</p>
474474
</div>
475475
<div class="section" id="credits">
@@ -488,6 +488,10 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
488488
<li>Pilar Vargas</li>
489489
</ul>
490490
</li>
491+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
492+
<li>Bhavesh Heliconia</li>
493+
</ul>
494+
</li>
491495
</ul>
492496
</div>
493497
<div class="section" id="maintainers">
@@ -501,7 +505,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
501505
promote its widespread use.</p>
502506
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
503507
<p><a class="reference external image-reference" href="https://github.com/pilarvargas-tecnativa"><img alt="pilarvargas-tecnativa" src="https://github.com/pilarvargas-tecnativa.png?size=40px" /></a></p>
504-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/event/tree/17.0/event_sale_reservation">OCA/event</a> project on GitHub.</p>
508+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/event/tree/18.0/event_sale_reservation">OCA/event</a> project on GitHub.</p>
505509
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
506510
</div>
507511
</div>

event_sale_reservation/tests/test_event_sale.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44
from datetime import datetime, timedelta
55

6-
from odoo.tests.common import Form
6+
from odoo.tests import Form
77

88
from odoo.addons.base.tests.common import BaseCommon
99

@@ -21,7 +21,7 @@ def setUpClass(cls):
2121
cls.products = cls.env["product.product"].create(
2222
[
2323
{
24-
"detailed_type": "event_reservation",
24+
"type": "event_reservation",
2525
"event_reservation_type_id": cls.event_types[num].id,
2626
"list_price": num,
2727
"name": "product reservation for event type %d" % num,
@@ -111,7 +111,7 @@ def test_wrong_product_reservation_without_type(self):
111111
with self.assertRaises(ReservationWithoutEventTypeError):
112112
self.env["product.product"].create(
113113
{
114-
"detailed_type": "event_reservation",
114+
"type": "event_reservation",
115115
"list_price": 10,
116116
"name": "event reservation without event type fails",
117117
}

event_sale_reservation/views/event_type_view.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
<field name="model">event.type</field>
3535
<field name="inherit_id" ref="event.view_event_type_tree" />
3636
<field name="arch" type="xml">
37-
<tree>
37+
<list>
3838
<field
3939
name="seats_reservation_total"
4040
groups="sales_team.group_sale_salesman"
4141
/>
42-
</tree>
42+
</list>
4343
</field>
4444
</record>
4545
</data>

event_sale_reservation/views/product_template_view.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<field name="model">product.template</field>
88
<field name="inherit_id" ref="product.product_template_form_view" />
99
<field name="arch" type="xml">
10-
<field name="detailed_type" position="after">
10+
<field name="type" position="after">
1111
<field
1212
name="event_reservation_type_id"
13-
invisible="detailed_type != 'event_reservation'"
14-
required="detailed_type == 'event_reservation'"
13+
invisible="type != 'event_reservation'"
14+
required="type == 'event_reservation'"
1515
groups="event.group_event_user"
1616
/>
1717
</field>

0 commit comments

Comments
 (0)