Skip to content
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

[ADD] event_track_multi_speaker #400

Open
wants to merge 12 commits into
base: 16.0
Choose a base branch
from
86 changes: 86 additions & 0 deletions event_track_multi_speaker/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=========================
Event Track Multi Speaker
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b68a380bf957a04f6f20f29ec5d8d1c62121548ca3853a7735dc98e82229043a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github
:target: https://github.com/OCA/event/tree/16.0/event_track_multi_speaker
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-16-0/event-16-0-event_track_multi_speaker
: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/event&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Allow for several speaker on event tracks

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/event/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/event/issues/new?body=module:%20event_track_multi_speaker%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.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Victor Champonnois

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-victor-champonnois| image:: https://github.com/victor-champonnois.png?size=40px
:target: https://github.com/victor-champonnois
:alt: victor-champonnois

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victor-champonnois|

This module is part of the `OCA/event <https://github.com/OCA/event/tree/16.0/event_track_multi_speaker>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions event_track_multi_speaker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import models
27 changes: 27 additions & 0 deletions event_track_multi_speaker/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "Event Track Multi Speaker",
"summary": """
Allow for several speaker on event tracks""",
"version": "16.0.1.0.0",
"category": "Uncategorized",

This comment was marked as outdated.

"website": "https://github.com/OCA/event",
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"maintainers": ["victor-champonnois"],
"license": "AGPL-3",
"application": False,
"depends": ["website_event_track"],
"excludes": [],
"data": [
"security/ir.model.access.csv",
"views/event_track.xml",
"views/event_track_speaker.xml",
"views/res_partner.xml",
"views/menuitems.xml",
],
"demo": [],
"qweb": [],
}
2 changes: 2 additions & 0 deletions event_track_multi_speaker/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import event_track
from . import event_track_speaker
13 changes: 13 additions & 0 deletions event_track_multi_speaker/models/event_track.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2017 David Vidal<[email protected]>
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class EventTrack(models.Model):
_inherit = "event.track"

speaker_ids = fields.Many2many(
comodel_name="event.track.speaker", string="Speakers"
)
46 changes: 46 additions & 0 deletions event_track_multi_speaker/models/event_track_speaker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2017 David Vidal<[email protected]>
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo.exceptions import UserError


class EventTrackSpeaker(models.Model):
_name = "event.track.speaker"
_description = "Track Speaker"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char(related="partner_id.name")
email = fields.Char(related="partner_id.email")
phone = fields.Char(related="partner_id.phone")
biography = fields.Html(related="partner_id.website_description")
function = fields.Char(related="partner_id.function")
image = fields.Image(related="partner_id.image_256")
partner_id = fields.Many2one("res.partner", string="Contact")
track_ids = fields.Many2many(
comodel_name="event.track",
string="Tracks",
)
status = fields.Selection(
selection=[
("draft", "Draft"),
("waiting", "Waiting"),
("validated", "Validated"),
],
default="draft",
)
event_id = fields.Many2one(
"event.event", compute="_compute_event", string="Event", store=True
)

@api.depends("track_ids.event_id")
def _compute_event(self):
if self.track_ids:
self.event_id = self.track_ids[0].event_id

Check warning on line 40 in event_track_multi_speaker/models/event_track_speaker.py

View check run for this annotation

Codecov / codecov/patch

event_track_multi_speaker/models/event_track_speaker.py#L40

Added line #L40 was not covered by tests

@api.constrains("track_ids")
def _check_unique_event(self):
for speaker in self:
if len(speaker.mapped("track_ids").mapped("event_id")) > 1:
raise UserError(_("Speakers should belong to only one event."))

Check warning on line 46 in event_track_multi_speaker/models/event_track_speaker.py

View check run for this annotation

Codecov / codecov/patch

event_track_multi_speaker/models/event_track_speaker.py#L46

Added line #L46 was not covered by tests
3 changes: 3 additions & 0 deletions event_track_multi_speaker/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Victor Champonnois
1 change: 1 addition & 0 deletions event_track_multi_speaker/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow for several speaker on event tracks
2 changes: 2 additions & 0 deletions event_track_multi_speaker/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_track_speaker,event.track.speaker.user,event_track_multi_speaker.model_event_track_speaker,event.group_event_user,1,1,1,1

This comment was marked as outdated.

Loading
Loading