Skip to content

Commit

Permalink
[IMP] resource_booking: add freezegun as a python external dependency
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
rrebollo authored and norlinhenrik committed Feb 13, 2024
1 parent 3fe4807 commit b9a6c0d
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 124 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ env:

# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2019
ecmaVersion: 11
sourceType: module

overrides:
- files:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# generated from manifests external_dependencies
cssselect
freezegun
20 changes: 12 additions & 8 deletions resource_booking/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Resource booking
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:17ca982be0206aaadf1595108e53e37b5812a0963b66d3debc7530a9798b5a95
!! source digest: sha256:727ff47355bc2d37a48cd4c600e645450283a3500633734f8947e12ac3502e31
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand All @@ -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|
Expand Down Expand Up @@ -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.

Expand All @@ -186,6 +186,7 @@ Contributors
~~~~~~~~~~~~

* Jairo Llopis <[email protected]> (https://www.tecnativa.com/)
* Henrik Norlin (https://ows.cloud)

Maintainers
~~~~~~~~~~~
Expand All @@ -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.
10 changes: 8 additions & 2 deletions resource_booking/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"python": [
# Used implicitly
"cssselect",
"freezegun",
],
},
"depends": [
Expand All @@ -40,8 +41,13 @@
"views/menus.xml",
],
"assets": {
"web.assets_frontend": ["resource_booking/static/src/scss/portal.scss"],
"web.assets_tests": ["resource_booking/static/src/js/resource_booking_tour.js"],
"web.assets_frontend": [
"resource_booking/static/src/js/booking_portal.js",
"resource_booking/static/src/scss/portal.scss",
],
"web.assets_tests": [
"resource_booking/static/src/js/tours/resource_booking_tour.js"
],
},
"demo": ["demo/res_users_demo.xml"],
}
8 changes: 5 additions & 3 deletions resource_booking/models/resource_booking.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,10 @@ def _sync_meeting(self):
to_create.append(meeting_vals)
else:
to_delete |= one.meeting_id
to_delete.unlink()
_self.env["calendar.event"].create(to_create)
if to_delete:
to_delete.unlink()

Check warning on line 436 in resource_booking/models/resource_booking.py

View check run for this annotation

Codecov / codecov/patch

resource_booking/models/resource_booking.py#L436

Added line #L436 was not covered by tests
if to_create:
_self.env["calendar.event"].create(to_create)

@api.constrains("combination_id", "meeting_id", "type_id")
def _check_scheduling(self):
Expand Down Expand Up @@ -697,7 +699,7 @@ def action_schedule(self):
self.duration, False
),
default_resource_booking_ids=[(6, 0, self.ids)],
default_name=self.name,
default_name=self.name or "",
),
"name": _("Schedule booking"),
"res_model": "calendar.event",
Expand Down
2 changes: 1 addition & 1 deletion resource_booking/models/resource_booking_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ResourceBookingType(models.Model):
default="random",
help=(
"Choose how to auto-assign resource combinations. "
"It has no effect if assiged manually."
"It has no effect if assigned manually."
),
)
combination_rel_ids = fields.One2many(
Expand Down
13 changes: 7 additions & 6 deletions resource_booking/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Resource booking</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:17ca982be0206aaadf1595108e53e37b5812a0963b66d3debc7530a9798b5a95
!! source digest: sha256:727ff47355bc2d37a48cd4c600e645450283a3500633734f8947e12ac3502e31
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/calendar/tree/15.0/resource_booking"><img alt="OCA/calendar" src="https://img.shields.io/badge/github-OCA%2Fcalendar-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/calendar-15-0/calendar-15-0-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/calendar&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/calendar/tree/16.0/resource_booking"><img alt="OCA/calendar" src="https://img.shields.io/badge/github-OCA%2Fcalendar-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/calendar-16-0/calendar-16-0-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/calendar&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a new app to allow you to book resource combinations in given
schedules.</p>
<p>Example use cases:</p>
Expand Down Expand Up @@ -521,7 +521,7 @@ <h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/calendar/issues">GitHub Issues</a>.
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
<a class="reference external" href="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</a>.</p>
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -536,6 +536,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
<ul class="simple">
<li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt; (<a class="reference external" href="https://www.tecnativa.com/">https://www.tecnativa.com/</a>)</li>
<li>Henrik Norlin (<a class="reference external" href="https://ows.cloud">https://ows.cloud</a>)</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -545,9 +546,9 @@ <h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/calendar/tree/15.0/resource_booking">OCA/calendar</a> project on GitHub.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/ows-cloud"><img alt="ows-cloud" src="https://github.com/ows-cloud.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/calendar/tree/16.0/resource_booking">OCA/calendar</a> project on GitHub.</p>
<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>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions resource_booking/static/src/js/booking_portal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @odoo-module */

import publicWidget from "web.public.widget";
import "portal.portal"; // Force dependencies

publicWidget.registry.PortalHomeCounters.include({
/**
* @override
*/
_getCountersAlwaysDisplayed() {
return this._super(...arguments).concat(["booking_count"]);
},
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
odoo.define("resource_booking.tour", function (require) {
"use strict";

var tour = require("web_tour.tour");

tour.register(
Expand Down
Loading

0 comments on commit b9a6c0d

Please sign in to comment.