Skip to content

Commit ea3dca7

Browse files
author
Anusha
committed
[MIG] sale_resource_booking: Migration to 18.0
1 parent 6b375ec commit ea3dca7

17 files changed

+100
-106
lines changed

sale_resource_booking/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Sell resource bookings
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:2c7b056857ea134dae0ac6043e2982ce997241cd8c4794123f23c322d1f01f01
10+
!! source digest: sha256:f7b67664bfd13e82684465bc6234ce76e9d2b3545a3b49d6737524587e778a56
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

sale_resource_booking/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Sell resource bookings",
66
"summary": "Link resource bookings with sales",
7-
"version": "15.0.1.0.1",
7+
"version": "18.0.1.0.0",
88
"development_status": "Beta",
99
"category": "Appointments",
1010
"website": "https://github.com/OCA/sale-workflow",

sale_resource_booking/i18n/es.po

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ msgstr ""
77
"Project-Id-Version: Odoo Server 12.0\n"
88
"Report-Msgid-Bugs-To: \n"
99
"POT-Creation-Date: 2021-04-22 10:26+0000\n"
10-
"PO-Revision-Date: 2023-10-10 20:36+0000\n"
11-
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
10+
"PO-Revision-Date: 2021-04-22 11:29+0100\n"
11+
"Last-Translator: Jairo Llopis <jairo.llopis@tecnativa.com>\n"
1212
"Language-Team: \n"
13-
"Language: es\n"
13+
"Language: es_ES\n"
1414
"MIME-Version: 1.0\n"
1515
"Content-Type: text/plain; charset=UTF-8\n"
1616
"Content-Transfer-Encoding: 8bit\n"
17-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
18-
"X-Generator: Weblate 4.17\n"
17+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
18+
"X-Generator: Poedit 2.4.2\n"
1919

2020
#. module: sale_resource_booking
2121
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
@@ -38,7 +38,7 @@ msgid "Booking type"
3838
msgstr "Tipo de reserva/cita"
3939

4040
#. module: sale_resource_booking
41-
#: code:addons/sale_resource_booking/models/sale_order.py:0
41+
#: code:addons/sale_resource_booking/models/sale_order.py:39
4242
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
4343
#, python-format
4444
msgid "Bookings"
@@ -219,6 +219,11 @@ msgstr "Cuenta de reservas de recursos"
219219
msgid "Resource combination"
220220
msgstr "Combinación de recursos"
221221

222+
#. module: sale_resource_booking
223+
#: model:ir.model,name:sale_resource_booking.model_sale_order
224+
msgid "Sale Order"
225+
msgstr "Pedido de venta"
226+
222227
#. module: sale_resource_booking
223228
#: model:ir.model,name:sale_resource_booking.model_resource_booking_sale
224229
msgid "Sale order generator for resource booking types"
@@ -244,11 +249,6 @@ msgstr "Pedido de venta que originó esta reserva/cita."
244249
msgid "Sales"
245250
msgstr "Ventas"
246251

247-
#. module: sale_resource_booking
248-
#: model:ir.model,name:sale_resource_booking.model_sale_order
249-
msgid "Sales Order"
250-
msgstr "Orden de Venta"
251-
252252
#. module: sale_resource_booking
253253
#: model:ir.model,name:sale_resource_booking.model_sale_order_line
254254
msgid "Sales Order Line"
@@ -263,6 +263,3 @@ msgstr "Guardar sin enviar invitaciones"
263263
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
264264
msgid "Sync bookings"
265265
msgstr "Sincronizar reservas/citas"
266-
267-
#~ msgid "Sale Order"
268-
#~ msgstr "Pedido de venta"

sale_resource_booking/i18n/fr.po

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Translation of Odoo Server.
22
# This file contains the translation of the following modules:
3-
# * sale_resource_booking
3+
# * sale_resource_booking
44
#
55
msgid ""
66
msgstr ""
@@ -18,11 +18,7 @@ msgstr ""
1818

1919
#. module: sale_resource_booking
2020
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
21-
msgid ""
22-
"(Re)sync resource bookings. The sync will be done automatically when "
23-
"confirming the quotation, but you can do it beforehand if needed with this "
24-
"button. It will create missing resource bookings in pending state, or cancel "
25-
"the spare ones."
21+
msgid "(Re)sync resource bookings. The sync will be done automatically when confirming the quotation, but you can do it beforehand if needed with this button. It will create missing resource bookings in pending state, or cancel the spare ones."
2622
msgstr ""
2723
"(Re)synchroniser les réservations de ressources. La synchronisation sera "
2824
"faite automatiquement à la confirmation du devis mais vous pouvez le faire "
@@ -37,7 +33,7 @@ msgid "Booking type"
3733
msgstr "Type de réservation"
3834

3935
#. module: sale_resource_booking
40-
#: code:addons/sale_resource_booking/models/sale_order.py:0
36+
#: code:addons/sale_resource_booking/models/sale_order.py:39
4137
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
4238
#, python-format
4339
msgid "Bookings"
@@ -119,20 +115,15 @@ msgstr "Si coché, une réservation en attente sera générée à la vente."
119115
#. module: sale_resource_booking
120116
#: model:ir.model.fields,help:sale_resource_booking.field_product_product__resource_booking_type_combination_rel_id
121117
#: model:ir.model.fields,help:sale_resource_booking.field_product_template__resource_booking_type_combination_rel_id
122-
msgid ""
123-
"If set, the booking will be created with this resource combination. "
124-
"Otherwise, the combination will be assigned automatically later, when the "
125-
"requester schedules the booking."
118+
msgid "If set, the booking will be created with this resource combination. Otherwise, the combination will be assigned automatically later, when the requester schedules the booking."
126119
msgstr ""
127120
"Si coché, la réservation sera crée avec cette combinaison de ressources. "
128121
"Autrement, la combinaison sera assignée automatiquement plus tard lorsque le "
129122
"demandeur planifiera la réservation."
130123

131124
#. module: sale_resource_booking
132125
#: model:ir.model.fields,help:sale_resource_booking.field_resource_booking__sale_order_state
133-
msgid ""
134-
"If there is a related quotation and it is not confirmed, the booking will "
135-
"not be able to become confirmed."
126+
msgid "If there is a related quotation and it is not confirmed, the booking will not be able to become confirmed."
136127
msgstr ""
137128
"Si il y a un devis lié qui n'est pas confirmé, la réservation ne pourra pas "
138129
"passer en confirmé."
@@ -219,6 +210,11 @@ msgstr "Nombre de réservation de ressources"
219210
msgid "Resource combination"
220211
msgstr "Combinaison de ressources"
221212

213+
#. module: sale_resource_booking
214+
#: model:ir.model,name:sale_resource_booking.model_sale_order
215+
msgid "Sale Order"
216+
msgstr "Commande"
217+
222218
#. module: sale_resource_booking
223219
#: model:ir.model,name:sale_resource_booking.model_resource_booking_sale
224220
msgid "Sale order generator for resource booking types"
@@ -244,11 +240,6 @@ msgstr "Commande d'origine de cette réservation."
244240
msgid "Sales"
245241
msgstr "Ventes"
246242

247-
#. module: sale_resource_booking
248-
#: model:ir.model,name:sale_resource_booking.model_sale_order
249-
msgid "Sales Order"
250-
msgstr ""
251-
252243
#. module: sale_resource_booking
253244
#: model:ir.model,name:sale_resource_booking.model_sale_order_line
254245
msgid "Sales Order Line"
@@ -263,6 +254,3 @@ msgstr "Sauvegarder sans envoyer d'invitations"
263254
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
264255
msgid "Sync bookings"
265256
msgstr "Synchroniser les réservations"
266-
267-
#~ msgid "Sale Order"
268-
#~ msgstr "Commande"

sale_resource_booking/i18n/fr_CH.po

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Translation of Odoo Server.
22
# This file contains the translation of the following modules:
3-
# * sale_resource_booking
3+
# * sale_resource_booking
44
#
55
msgid ""
66
msgstr ""
@@ -18,11 +18,7 @@ msgstr ""
1818

1919
#. module: sale_resource_booking
2020
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
21-
msgid ""
22-
"(Re)sync resource bookings. The sync will be done automatically when "
23-
"confirming the quotation, but you can do it beforehand if needed with this "
24-
"button. It will create missing resource bookings in pending state, or cancel "
25-
"the spare ones."
21+
msgid "(Re)sync resource bookings. The sync will be done automatically when confirming the quotation, but you can do it beforehand if needed with this button. It will create missing resource bookings in pending state, or cancel the spare ones."
2622
msgstr ""
2723
"(Re)synchroniser les réservations de ressources. La synchronisation sera "
2824
"faite automatiquement à la confirmation du devis mais vous pouvez le faire "
@@ -37,7 +33,7 @@ msgid "Booking type"
3733
msgstr "Type de réservation"
3834

3935
#. module: sale_resource_booking
40-
#: code:addons/sale_resource_booking/models/sale_order.py:0
36+
#: code:addons/sale_resource_booking/models/sale_order.py:39
4137
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
4238
#, python-format
4339
msgid "Bookings"
@@ -119,20 +115,15 @@ msgstr "Si coché, une réservation en attente sera générée à la vente."
119115
#. module: sale_resource_booking
120116
#: model:ir.model.fields,help:sale_resource_booking.field_product_product__resource_booking_type_combination_rel_id
121117
#: model:ir.model.fields,help:sale_resource_booking.field_product_template__resource_booking_type_combination_rel_id
122-
msgid ""
123-
"If set, the booking will be created with this resource combination. "
124-
"Otherwise, the combination will be assigned automatically later, when the "
125-
"requester schedules the booking."
118+
msgid "If set, the booking will be created with this resource combination. Otherwise, the combination will be assigned automatically later, when the requester schedules the booking."
126119
msgstr ""
127120
"Si coché, la réservation sera crée avec cette combinaison de ressources. "
128121
"Autrement, la combinaison sera assignée automatiquement plus tard lorsque le "
129122
"demandeur planifiera la réservation."
130123

131124
#. module: sale_resource_booking
132125
#: model:ir.model.fields,help:sale_resource_booking.field_resource_booking__sale_order_state
133-
msgid ""
134-
"If there is a related quotation and it is not confirmed, the booking will "
135-
"not be able to become confirmed."
126+
msgid "If there is a related quotation and it is not confirmed, the booking will not be able to become confirmed."
136127
msgstr ""
137128
"Si il y a un devis lié qui n'est pas confirmé, la réservation ne pourra pas "
138129
"passer en confirmé."
@@ -219,6 +210,11 @@ msgstr "Nombre de réservation de ressources"
219210
msgid "Resource combination"
220211
msgstr "Combinaison de ressources"
221212

213+
#. module: sale_resource_booking
214+
#: model:ir.model,name:sale_resource_booking.model_sale_order
215+
msgid "Sale Order"
216+
msgstr "Commande"
217+
222218
#. module: sale_resource_booking
223219
#: model:ir.model,name:sale_resource_booking.model_resource_booking_sale
224220
msgid "Sale order generator for resource booking types"
@@ -244,11 +240,6 @@ msgstr "Commande d'origine de cette réservation."
244240
msgid "Sales"
245241
msgstr "Ventes"
246242

247-
#. module: sale_resource_booking
248-
#: model:ir.model,name:sale_resource_booking.model_sale_order
249-
msgid "Sales Order"
250-
msgstr ""
251-
252243
#. module: sale_resource_booking
253244
#: model:ir.model,name:sale_resource_booking.model_sale_order_line
254245
msgid "Sales Order Line"
@@ -263,6 +254,3 @@ msgstr "Sauvegarder sans envoyer d'invitations"
263254
#: model_terms:ir.ui.view,arch_db:sale_resource_booking.view_order_form
264255
msgid "Sync bookings"
265256
msgstr "Synchroniser les réservations"
266-
267-
#~ msgid "Sale Order"
268-
#~ msgstr "Commande"

sale_resource_booking/models/resource_booking.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ class ResourceBooking(models.Model):
3131
)
3232

3333
@api.depends(
34-
"active", "meeting_id.attendee_ids.state", "sale_order_line_id.order_id.state"
34+
"active",
35+
"meeting_id.attendee_ids.state",
36+
"sale_order_line_id.order_id.locked",
37+
"sale_order_line_id.order_id.state",
3538
)
3639
def _compute_state(self):
3740
"""A booking can only be confirmed if its sale order is confirmed.
@@ -41,11 +44,13 @@ def _compute_state(self):
4144
automatically after payment.
4245
"""
4346
result = super()._compute_state()
44-
# False means "no sale order"
45-
confirmable_states = {False, "sale", "done"}
4647
for one in self:
4748
# Only affect confirmed bookings related to unconfirmed quotations
48-
if one.state != "confirmed" or one.sale_order_state in confirmable_states:
49+
if (
50+
one.state != "confirmed"
51+
or not one.sale_order_line_id
52+
or one.sale_order_state == "sale"
53+
):
4954
continue
5055
# SO is not confirmed; neither is booking
5156
one.state = "scheduled"

sale_resource_booking/models/sale_order.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ def _compute_resource_bookings(self):
3535

3636
def action_open_resource_bookings(self):
3737
"""Open related bookings."""
38-
result = {
38+
return {
3939
"domain": [("sale_order_id", "=", self.id)],
4040
"name": _("Bookings"),
4141
"res_model": "resource.booking",
4242
"target": "current",
4343
"type": "ir.actions.act_window",
4444
"view_mode": "list,calendar,form",
4545
}
46-
return result
4746

4847
def action_confirm(self):
4948
"""Ask to fill booking values, if necessary."""

sale_resource_booking/static/description/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">Sell resource bookings</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:2c7b056857ea134dae0ac6043e2982ce997241cd8c4794123f23c322d1f01f01
370+
!! source digest: sha256:f7b67664bfd13e82684465bc6234ce76e9d2b3545a3b49d6737524587e778a56
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372372
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/sale-workflow/tree/18.0/sale_resource_booking"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_resource_booking"><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/sale-workflow&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 sale and resource bookings to

sale_resource_booking/tests/test_sale_resource_booking.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
from contextlib import suppress
55
from datetime import datetime
66

7-
from odoo.tests.common import Form, TransactionCase
7+
from odoo.tests import Form
8+
from odoo.tools import mute_logger
89

10+
from odoo.addons.base.tests.common import BaseCommon
911
from odoo.addons.resource_booking.tests.common import create_test_data
1012

1113

12-
class SaleResourceBookingsCase(TransactionCase):
14+
class SaleResourceBookingsCase(BaseCommon):
1315
@classmethod
1416
def setUpClass(cls):
1517
super().setUpClass()
@@ -31,6 +33,7 @@ def _run_action(self, action):
3133
return model.search(action["domain"])
3234
return model
3335

36+
@mute_logger("odoo.models.unlink")
3437
def _test_wizard_quotation(self, combination_rel):
3538
"""Test quotation wizard."""
3639
assert combination_rel._name == "resource.booking.type.combination.rel"
@@ -87,7 +90,7 @@ def _test_wizard_quotation(self, combination_rel):
8790
else:
8891
self.assertEqual(bookings.mapped("combination_auto_assign"), [True] * 2)
8992
# Cancel SO, bookings canceled
90-
order.action_cancel()
93+
order._action_cancel()
9194
self.assertEqual(bookings.mapped("state"), ["canceled"] * 2)
9295
# Delete SO lines, bookings deleted
9396
order.order_line.unlink()
@@ -122,7 +125,7 @@ def test_order_state_limits_booking_state(self):
122125
self.assertTrue(booking)
123126
self.assertEqual(booking.state, "pending")
124127
# Cancel order; booking canceled
125-
order.action_cancel()
128+
order._action_cancel()
126129
self.assertEqual(booking.state, "canceled")
127130
# Manually set order and booking to pending
128131
order.action_draft()

sale_resource_booking/views/product_template_views.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
<field name="name">Display resource booking info in form</field>
77
<field name="model">product.template</field>
88
<field name="inherit_id" ref="product.product_template_form_view" />
9-
<field name="groups_id" eval="[(4, ref('resource_booking.group_user'), 0)]" />
109
<field name="arch" type="xml">
11-
<group name='sale' position='inside'>
12-
<group name="booking" string="Resource Bookings">
10+
<group name="sale" position='inside'>
11+
<group
12+
name="booking"
13+
string="Resource Bookings"
14+
groups="resource_booking.group_user"
15+
>
1316
<field name="resource_booking_type_id" />
1417
<field
1518
name="resource_booking_type_combination_rel_id"
16-
attrs="{'invisible': [('resource_booking_type_id', '=', False)]}"
19+
invisible="not resource_booking_type_id"
1720
/>
1821
</group>
1922
</group>

0 commit comments

Comments
 (0)