-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] resource_booking: Migration to 16.0
Changes done: - [FIX] _get_available_slots - [IMP] new field slot_duration - [IMP] Button (partner -> booking) - [IMP] combination -> bookings -> create: default combination - [FIX] _get_intervals() when type_id is missing - [IMP] booking: search on combination - [FIX] _availability_is_fitting() - [IMP] booking list view with hidden partner_ids - [FIX] attendance hour_to 23:59 -> 24:00 - [FIX] pre-commit - [FIX] calendar_slot_duration format - [FIX] _get_calendar_context() with correct start / timezone Co-authored-by: Henrik Norlin
- Loading branch information
1 parent
cbae059
commit b31f313
Showing
18 changed files
with
219 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ Resource booking | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:2a68fc2648f97ac64afcd5e5c6fa3ab28bfe94008b501d0ebad818d9e9bd3140 | ||
!! source digest: sha256:69da76a920e2d581cfc27db05479e5705f196298cbbe67e881c92bf1ea6363af | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
|
@@ -17,13 +17,13 @@ Resource booking | |
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcalendar-lightgray.png?logo=github | ||
:target: https://github.com/OCA/calendar/tree/15.0/resource_booking | ||
:target: https://github.com/OCA/calendar/tree/16.0/resource_booking | ||
:alt: OCA/calendar | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/calendar-15-0/calendar-15-0-resource_booking | ||
:target: https://translation.odoo-community.org/projects/calendar-16-0/calendar-16-0-resource_booking | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/calendar&target_branch=15.0 | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/calendar&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
@@ -170,7 +170,7 @@ Bug Tracker | |
Bugs are tracked on `GitHub Issues <https://github.com/OCA/calendar/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 | ||
`feedback <https://github.com/OCA/calendar/issues/new?body=module:%20resource_booking%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
`feedback <https://github.com/OCA/calendar/issues/new?body=module:%20resource_booking%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
|
@@ -186,6 +186,7 @@ Contributors | |
~~~~~~~~~~~~ | ||
|
||
* Jairo Llopis <[email protected]> (https://www.tecnativa.com/) | ||
* Henrik Norlin (https://ows.cloud) | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
@@ -203,11 +204,14 @@ promote its widespread use. | |
.. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px | ||
:target: https://github.com/pedrobaeza | ||
:alt: pedrobaeza | ||
.. |maintainer-ows-cloud| image:: https://github.com/ows-cloud.png?size=40px | ||
:target: https://github.com/ows-cloud | ||
:alt: ows-cloud | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-pedrobaeza| | ||
|maintainer-pedrobaeza| |maintainer-ows-cloud| | ||
|
||
This module is part of the `OCA/calendar <https://github.com/OCA/calendar/tree/15.0/resource_booking>`_ project on GitHub. | ||
This module is part of the `OCA/calendar <https://github.com/OCA/calendar/tree/16.0/resource_booking>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def _update_attendance_hour_to(env): | ||
"""According to the refactoring of _merge_intervals() a booking from 23:00 to 01:00 | ||
of the next day must be completely available, having defined hour_to=23.59 is not, | ||
so it is changed to 24.0. | ||
This behavior is confirmed to be correct because in the tests calendars are set | ||
with full days (hour_from=0, hour_to=24).""" | ||
lines = env["resource.calendar.attendance"].search( | ||
[("hour_to", ">=", 23 + 59 / 60)] | ||
) | ||
lines.hour_to = 24.0 | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
_update_attendance_hour_to(env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
resource_booking_count = fields.Integer( | ||
compute="_compute_resource_booking_count", string="Resource booking count" | ||
) | ||
resource_booking_ids = fields.One2many( | ||
"resource.booking", "partner_id", string="Bookings" | ||
) | ||
|
||
def _compute_resource_booking_count(self): | ||
for p in self: | ||
p.resource_booking_count = len(p.resource_booking_ids) | ||
|
||
def action_view_resource_booking(self): | ||
self.ensure_one() | ||
action = self.env["ir.actions.actions"]._for_xml_id( | ||
"resource_booking.resource_booking_action" | ||
) | ||
action["context"] = { | ||
"default_partner_id": self.id, | ||
} | ||
return action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
* Jairo Llopis <[email protected]> (https://www.tecnativa.com/) | ||
* Henrik Norlin (https://ows.cloud) |
Oops, something went wrong.