-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][MIG] resource_booking: Migration to 16.0 #101
Conversation
526c899
to
c480d0f
Compare
I had to rename |
Check OCA/openupgradelib#338 |
Thank you for the link, @pedrobaeza data-target should change to data-bs-target. |
It's more like a mapping reference than a direct tool
Yes, as the prefix |
8f63084
to
1606216
Compare
I have included Allow a booking to span more than one calendar day #100 @yajo @pedrobaeza Would you like to review? |
Please, cherry-pick #104 (resolves the comment in #101 (comment)) |
c225a57
to
7921fe3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, solve the web_calendar_slot_duration
dependency and attend the comments.
@Tecnativa TT45649
default_type_id=self.id, | ||
# Context used by web_calendar_slot_duration module | ||
calendar_slot_duration=FloatTimeParser.value_to_html( | ||
self.duration, False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.duration, False | |
self.slot_duration, False |
You added a slot_duration field intentionally to separe the duration of the booking and the slot in calendar, so this change is consequent. But anyway this change is uselles because without the dependency of web_calendar_slot_duration
this doesn't work.
If you look at my PR: OCA/web#2646 , you must notice that the slot_duration that expects is in this format: (00:00:00), but this FloatTimeParser function returns it in this one: (00:00). So you will have to make a conversion from the Float to this first format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is (00:00:00) new for v16?
If yes, can you help me with this conversion?
If no, can you show me where the conversion is done for self.duration?
resource_booking/__manifest__.py
Outdated
@@ -25,7 +25,6 @@ | |||
"mail", | |||
"portal", | |||
"resource", | |||
"web_calendar_slot_duration", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't remove this dependency, it is necessary to maintain the functionallity of the module. Here I post a PR that i made migrating correctly the module: OCA/web#2646
Hi how are you? There is one commit missing from 15.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question regarding the process, |
Yes, it can act like Calendly. Just click on the Share button of the resource booking. |
Thank you for all the feedback. I will work on this one of the next days. |
Should I squash together all my commits, or just those who are highly related? Improvements in this migration:
|
Thank you for your efforts. Could you push again to see if the problem with the pre-commit is resolved? It looks like there was some problem during the process with the nodejs environment. |
This module adds a new app to allow you to book resource combinations in given schedules. Example use cases: * Management of consultations in a clinic. * Salesman appointments. * Classroom and projector reservations. * Hotel room booking. Among the things you can do: * Specify the type of booking, which includes a calendar of availability. * Specify which resources can be booked together. All of them must be free to be booked. * Place pending bookings, effectively giving permissions to someone to see the availability calendar and choose one slot. * Partners can do that from their portals. * If a partner has no user, he can still do the same via a tokenized URL. * Backend users can also do that from the backend. * Booking lifecycle with computed states. * Automatic meeting creation and deletion. * Automatic conflict detection. * Deadline to block modifications. @Tecnativa TT28201
Currently translated at 100.0% (190 of 190 strings) Translation: calendar-12.0/calendar-12.0-resource_booking Translate-URL: https://translation.odoo-community.org/projects/calendar-12-0/calendar-12-0-resource_booking/es/
…ating calendars Without this patch, users couldn't change a calendar schedule if there were past or unconfirmed bookings that wouldn't fit in it. Excluding those bookings from the check fixes the situation. We also check that, to confirm a booking, it must fit in the calendar (because now it can happen that, in the time that has passed since the booking was scheduled until it is confirmed, the calendar changes). @Tecnativa TT29509
The notifications emitted to the resource booking requester must always be in the same TZ as the resource booking itself. For example, if you book one hotel room in the other side of the world, a notification in your own TZ is confusing. Besides, res.partner created from website_sale are created with `tz=False`, making it even more confusing. @Tecnativa TT30331
The constraint that checks the schedule of a resource booking is currently being applied to all the bookings, including past ones. As the resource combination or associated calendars might change regularly and trigger a recomputation of this, such change might take a very long time. Plus, the calendar restrictions might change, trigger a recompute of the constraint and detect bookings that can't be assigned, which makes no sense when they already happened. This applies it only to future bookings, ignoring past ones. TT30478
I would like to update the documentation about |
@norlinhenrik I was doing some testing using runboat build on the last commit to this PR. Something bizarre it's happening using a tokenized url to portal to schedule the book: It gets stuck on December 2023. See what I mean. First I'm showing the settings (Basically everyone is in the same TZ), later the "problem". I'm using a negative timezone (-5 I think): Surely the core of the issue is: def _get_calendar_context(self, year=None, month=None, now=None):
"""Get the required context for the calendar view in the portal.
See the `resource_booking.scheduling_calendar` view.
:param int year: Year of the calendar to be displayed.
:param int month: Month of the calendar to be displayed.
:param datetime now: Represents the current datetime.
"""
month1 = relativedelta(months=1)
now = now or fields.Datetime.now()
year = year or now.year
month = month or now.month
start = datetime(year, month, 1)
start, now = (
fields.Datetime.context_timestamp(self, dt) for dt in (start, now)
)
start = start.replace(hour=0, minute=0, second=0, microsecond=0)
lang = self.env["res.lang"]._lang_get(self.env.lang or self.env.user.lang)
weekday_names = dict(lang.fields_get(["week_start"])["week_start"]["selection"])
booking_duration = timedelta(hours=self.duration)
slots = self._get_available_slots(start, start + month1 + booking_duration)
return {
"booking": self,
"calendar": calendar.Calendar(int(lang.week_start) - 1),
"now": now,
"res_lang": lang,
"slots": slots,
"start": start,
"weekday_names": weekday_names,
} It isn't clear to me why: start, now = (
fields.Datetime.context_timestamp(self, dt) for dt in (start, now)
) should'nt the target here be January 1st, 2024 no matter TZ? @pedrobaeza Am I getting things wrong?
|
|
0b29fe7
to
16abc45
Compare
@norlinhenrik partner auto-subcription to bookings looks like isn't working either here. I'm taking this. |
@norlinhenrik I think it is intended because in related calendar events followers are rigthtly settled. So I think no work is required here. |
@norlinhenrik I made an small fix. When trying to schedule a booking from booking form view but no name has been given to the booking it raises an OWl error when clicking on the calendar view. I created a PR to your branch. Please check it out. |
not to rush anybody, but lets keep the momentum! i'm willing to help in any way i can to get this merged asap |
@ayushin If you have tested and think it is ready to merge, then click on Files changed -> Review changes -> Approve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jelenapoblet I think I "fixed" the calendar going wider. According to Bootstrap 5.1 doc .table-responsive-md should be in a div as parent for the table element with .table. @norlinhenrik PR loymcom#1. |
/ocabot migration resource_booking Please finish your reviews. |
@rrebollo I have included your latest commit. |
Great, please squash all the commits by author into their migration one for being mergeable. |
4d678fb
to
b9a6c0d
Compare
Done |
resource_booking/__manifest__.py
Outdated
"python": [ | ||
# Used implicitly | ||
"cssselect", | ||
"freezegun", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. This dependency is not for the module, but for tests. You must remove it from here and put it in test_requirements.txt
file in root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@norlinhenrik I have pushed to loymcom#1 a commit fixing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cssselect
may be needed for the module itself. I was talking about freezegun
. Anyway, the CI is still red.
[IMP] resource_booking: new field slot_duration [IMP] resource_booking: Button (partner -> booking) [IMP] resource_booking: combination -> bookings -> create: default combination [IMP] resource_booking: A booking may have multiple contacts, e.g. people in a room [FIX] resource_booking: _get_intervals() when type_id is missing [IMP] resource_booking: booking: search on combination [FIX] resource_booking: _availability_is_fitting() [IMP] resource_booking: booking list view with hidden partner_ids [FIX] resource_booking: migration: attendance hour_to 23:59 -> 24:00 [IMP] resource_booking: rename_xmlids [FIX] resource_booking: pre-commit [FIX] resource_booking: calendar_slot_duration format [FIX] resource_booking: _get_calendar_context() with correct start / timezone
[IMP] resource_booking: fix failling BackendCase. test_booking_from_calendar_view [IMP] resource_booking: fix typo in help parameter for combination_assignment field from resource_booking_type [IMP] resource_booking: fix failing PortalCase.test_portal_no_bookings Test was failling cause there was no bookings link on portal home for external users, then no trigger. Also I had to tweak eslintrc config cause precommit was failling due to ECMA version. [IMP] resource_booking: No create/unlink call if nothing to do [FIX] resource_booking: error CalendarQuickCreate title is not a string when scheduling a booking [FIX] resource_booking: portal responsive booking calendar table going wider and no x scroll
57b9e35
to
819b914
Compare
All checks have passed now. |
) | ||
name = fields.Char(index=True, help="Leave empty to autogenerate a booking name.") | ||
description = fields.Html() | ||
partner_id = fields.Many2one( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct according v15:
https://github.com/OCA/calendar/blob/15.0/resource_booking/models/resource_booking.py#L126
The compute/inverse is in this field, not in partner_ids
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partner_ids
was added to 15.0 after I suggested it for 16.0. Probably I don't need this field after all.
@pedrobaeza Feel free to propose a new commit to do the correction. You may remove partner_ids
if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think the field may be practcal in some scenarios, even though I don't need it right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@victoralmau please resume this migration including all the 15.0 stuff. Please complete and include #114 as well.
Superseed by #120 |
As the other has preserved attribution, closing in favor of it. |
Improvements in this migration:
Later PRs for version 15.0 of
resource_booking
(104, 106, 110, 111) are not included in this PR.