-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from coopiteasy/9.0-a13-available-bikes
[9.0] add available resource category tab on activities
- Loading branch information
Showing
16 changed files
with
396 additions
and
4 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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2020 Coop IT Easy | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo> | ||
<record id="resource_activity_type_tour_demo" model="resource.activity.type"> | ||
<field name="name">Tour</field> | ||
</record> | ||
<record id="base.user_root" model="res.users"> | ||
<field name="resource_location" ref="resource_planning.main_location"/> | ||
</record> | ||
<record id="base.user_demo" model="res.users"> | ||
<field name="resource_location" ref="resource_planning.main_location"/> | ||
</record> | ||
</odoo> |
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 @@ | ||
from . import test_opening_hours | ||
from . import test_resource_activity |
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,69 @@ | ||
# Copyright 2020 Coop IT Easy SCRL fs | ||
# Robin Keunen <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
|
||
from openerp.tests import common | ||
|
||
|
||
class TestResourceActivity(common.TransactionCase): | ||
def setUp(self): | ||
super(TestResourceActivity, self).setUp() | ||
self.main_location = self.browse_ref("resource_planning.main_location") | ||
self.activity_type = self.browse_ref( | ||
"resource_activity.resource_activity_type_tour_demo" | ||
) | ||
|
||
def test_compute_available_resources(self): | ||
activity_obj = self.env["resource.activity"] | ||
activity = activity_obj.create( | ||
{ | ||
"date_start": "2020-11-23 14:30", | ||
"date_end": "2020-11-23 16:00", | ||
"location_id": self.main_location.id, | ||
"activity_type": self.activity_type.id, | ||
} | ||
) | ||
self.assertEquals(len(activity.available_category_ids), 0) | ||
|
||
activity = activity_obj.create( | ||
{ | ||
"date_start": "2020-11-23 19:30", | ||
"date_end": "2020-11-23 20:00", | ||
"location_id": self.main_location.id, | ||
"activity_type": self.activity_type.id, | ||
} | ||
) | ||
categories = { | ||
av_categ.category_id.id: av_categ.nb_resources | ||
for av_categ in activity.available_category_ids | ||
} | ||
self.assertEquals({1: 1, 2: 1}, categories) | ||
|
||
activity = activity_obj.create( | ||
{ | ||
"date_start": "2020-11-23 17:00", | ||
"date_end": "2020-11-23 17:30", | ||
"location_id": self.main_location.id, | ||
"activity_type": self.activity_type.id, | ||
} | ||
) | ||
categories = { | ||
av_categ.category_id.id: av_categ.nb_resources | ||
for av_categ in activity.available_category_ids | ||
} | ||
self.assertEquals({1: 2}, categories) | ||
|
||
activity = activity_obj.create( | ||
{ | ||
"date_start": "2020-11-24 19:30", | ||
"date_end": "2020-11-24 20:00", | ||
"location_id": self.main_location.id, | ||
"activity_type": self.activity_type.id, | ||
} | ||
) | ||
categories = { | ||
av_categ.category_id.id: av_categ.nb_resources | ||
for av_categ in activity.available_category_ids | ||
} | ||
self.assertEquals({1: 2, 2: 1}, categories) |
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
############################################################################## | ||
{ | ||
"name": "Resource Planning", | ||
"version": "1.0", | ||
"version": "9.0.1.0.1", | ||
"depends": ["base", "mail", "resource", "web_gantt8",], | ||
"author": "Houssine BAKKALI <[email protected]>", | ||
"category": "Resource", | ||
|
@@ -43,6 +43,7 @@ | |
"views/actions.xml", | ||
"views/menus.xml", | ||
], | ||
"demo": ["demo/demo.xml",], | ||
"installable": True, | ||
"application": True, | ||
} |
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,85 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2020 Coop IT Easy | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo> | ||
<record id="resource_category_bike_demo" model="resource.category"> | ||
<field name="name">Bike</field> | ||
</record> | ||
<record id="resource_category_ebike_demo" model="resource.category"> | ||
<field name="name">E-Bike</field> | ||
</record> | ||
|
||
<record id="resource_resource_bike_1_demo" model="resource.resource"> | ||
<field name="name">Bike 1</field> | ||
<field name="serial_number">BK1</field> | ||
<field name="state">available</field> | ||
<field name="category_id" ref="resource_category_bike_demo"/> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_resource_bike_2_demo" model="resource.resource"> | ||
<field name="name">Bike 2</field> | ||
<field name="serial_number">BK2</field> | ||
<field name="state">available</field> | ||
<field name="category_id" ref="resource_category_bike_demo"/> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_resource_ebike_1_demo" model="resource.resource"> | ||
<field name="name">E-Bike 1</field> | ||
<field name="serial_number">EBK1</field> | ||
<field name="state">available</field> | ||
<field name="category_id" ref="resource_category_ebike_demo"/> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_resource_ebike_2_demo" model="resource.resource"> | ||
<field name="name">E-Bike 2</field> | ||
<field name="serial_number">EBK2</field> | ||
<field name="state">unavailable</field> | ||
<field name="category_id" ref="resource_category_ebike_demo"/> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
|
||
<record id="resource_allocation_1_demo" model="resource.allocation"> | ||
<field name="resource_id" ref="resource_resource_bike_1_demo"/> | ||
<field name="date_start">2020-11-23 14:00</field> | ||
<field name="date_end">2020-11-23 16:00</field> | ||
<field name="state">booked</field> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_allocation_2_demo" model="resource.allocation"> | ||
<field name="resource_id" ref="resource_resource_bike_1_demo"/> | ||
<field name="date_start">2020-11-23 18:00</field> | ||
<field name="date_end">2020-11-23 20:00</field> | ||
<field name="state">booked</field> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_allocation_3_demo" model="resource.allocation"> | ||
<field name="resource_id" ref="resource_resource_bike_2_demo"/> | ||
<field name="date_start">2020-11-23 10:00</field> | ||
<field name="date_end">2020-11-23 15:00</field> | ||
<field name="state">booked</field> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_allocation_4_demo" model="resource.allocation"> | ||
<field name="resource_id" ref="resource_resource_bike_2_demo"/> | ||
<field name="date_start">2020-11-23 19:00</field> | ||
<field name="date_end">2020-11-23 20:00</field> | ||
<field name="state">cancel</field> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_allocation_5_demo" model="resource.allocation"> | ||
<field name="resource_id" ref="resource_resource_ebike_1_demo"/> | ||
<field name="date_start">2020-11-23 17:00</field> | ||
<field name="date_end">2020-11-23 18:30</field> | ||
<field name="state">booked</field> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
<record id="resource_allocation_6_demo" model="resource.allocation"> | ||
<field name="resource_id" ref="resource_resource_ebike_1_demo"/> | ||
<field name="date_start">2020-11-23 14:00</field> | ||
<field name="date_end">2020-11-23 16:00</field> | ||
<field name="state">booked</field> | ||
<field name="location" ref="main_location"/> | ||
</record> | ||
</odoo> |
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
Oops, something went wrong.