Skip to content

Commit 25b79fd

Browse files
committed
[ADD] website_slides_attendees_completed_time: implement completed time tracking in attendee views
1 parent 787961f commit 25b79fd

File tree

15 files changed

+625
-0
lines changed

15 files changed

+625
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../website_slides_attendees_completed_time
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
=======================================
2+
Website Slides Attendees Completed Time
3+
=======================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:e15e26b7cb5d42f02ef1a21ffd984021c19230eeef3ca8c78b7f158110d918a3
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--learning-lightgray.png?logo=github
20+
:target: https://github.com/OCA/e-learning/tree/16.0/website_slides_attendees_completed_time
21+
:alt: OCA/e-learning
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/e-learning-16-0/e-learning-16-0-website_slides_attendees_completed_time
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-learning&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends the functionality of course attendee views to show
32+
course's completed time.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
After module installation, you will see course's completed time within
43+
attendee views.
44+
45+
.. image:: https://raw.githubusercontent.com/OCA/e-learning/16.0/website_slides_attendees_completed_time/static/description/attendees_tree_view.png
46+
:alt: Attendees Tree View
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-learning/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
If you spotted it first, help us to smash it by providing a detailed and welcomed
54+
`feedback <https://github.com/OCA/e-learning/issues/new?body=module:%20website_slides_attendees_completed_time%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
-------
63+
64+
* Binhex
65+
66+
Contributors
67+
------------
68+
69+
- Rolando Pérez [email protected] https://binhex.cloud
70+
71+
Maintainers
72+
-----------
73+
74+
This module is maintained by the OCA.
75+
76+
.. image:: https://odoo-community.org/logo.png
77+
:alt: Odoo Community Association
78+
:target: https://odoo-community.org
79+
80+
OCA, or the Odoo Community Association, is a nonprofit organization whose
81+
mission is to support the collaborative development of Odoo features and
82+
promote its widespread use.
83+
84+
This module is part of the `OCA/e-learning <https://github.com/OCA/e-learning/tree/16.0/website_slides_attendees_completed_time>`_ project on GitHub.
85+
86+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Binhex
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Website Slides Attendees Completed Time",
6+
"summary": """Show course completed time in attendee views""",
7+
"version": "16.0.1.0.0",
8+
"license": "AGPL-3",
9+
"author": "Binhex,Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/e-learning",
11+
"depends": ["website_slides"],
12+
"data": [
13+
"views/slide_channel_partner_views.xml",
14+
],
15+
"demo": [],
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import slide_slide_partner
2+
from . import slide_channel_partner
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2025 Binhex
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class SlideChannelPartner(models.Model):
8+
_inherit = "slide.channel.partner"
9+
10+
data_slide_partner_ids = fields.One2many(
11+
"slide.slide.partner", "channel_partner_id"
12+
)
13+
completed_time = fields.Float(
14+
"Completed Time (hours)", compute="_compute_completed_time", store=True
15+
)
16+
17+
@api.depends(
18+
"data_slide_partner_ids.completed",
19+
"data_slide_partner_ids.slide_id.completion_time",
20+
)
21+
def _compute_completed_time(self):
22+
"""
23+
Compute the total time spent on completed slides for a channel partner.
24+
"""
25+
for record in self:
26+
data_slide_partner = record.data_slide_partner_ids.filtered(
27+
lambda data: data.completed
28+
and data.slide_id.is_published
29+
and data.slide_id.active
30+
)
31+
32+
record.completed_time = sum(
33+
data_slide_partner.mapped("slide_id.completion_time"), 0.0
34+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2025 Binhex
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class SlideSlidePartner(models.Model):
8+
_inherit = "slide.slide.partner"
9+
10+
channel_partner_id = fields.Many2one(
11+
"slide.channel.partner", compute="_compute_channel_partner_id", store=True
12+
)
13+
14+
@api.depends("channel_id", "partner_id")
15+
def _compute_channel_partner_id(self):
16+
"""
17+
Compute the channel partner ID based on the channel and partner IDs.
18+
"""
19+
for record in self:
20+
channel_partner = self.env["slide.channel.partner"].search(
21+
[
22+
("channel_id", "=", record.channel_id.id),
23+
("partner_id", "=", record.partner_id.id),
24+
],
25+
limit=1,
26+
)
27+
record.channel_partner_id = channel_partner.id
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Rolando Pérez <[email protected]> https://binhex.cloud
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module extends the functionality of course attendee views to show course's completed time.

0 commit comments

Comments
 (0)