Compare commits
2 Commits
16.0-ci-pr
...
14.0
Author | SHA1 | Date | |
---|---|---|---|
547cac2aca | |||
fb012e4362 |
@@ -1,24 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event mail attachments",
|
|
||||||
"version": "16.0.0.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
'summary': 'Event mail attachments',
|
|
||||||
'description': """
|
|
||||||
Event mail attachments
|
|
||||||
----------------------------------------------------
|
|
||||||
|
|
||||||
""",
|
|
||||||
"category": "",
|
|
||||||
"depends": ["ctl_training_customization"],
|
|
||||||
"data": [
|
|
||||||
'views/mail_template_views.xml'
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
# Translation of Odoo Server.
|
|
||||||
# This file contains the translation of the following modules:
|
|
||||||
# * event_mail_attachment
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: Odoo Server 16.0\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2023-12-19 13:32+0000\n"
|
|
||||||
"PO-Revision-Date: 2023-12-19 13:32+0000\n"
|
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: \n"
|
|
||||||
"Plural-Forms: \n"
|
|
||||||
|
|
||||||
#. module: event_mail_attachment
|
|
||||||
#: model:ir.model.fields,field_description:event_mail_attachment.field_mail_template__event_attachment_name_prefix
|
|
||||||
msgid "Attachment name prefix"
|
|
||||||
msgstr "Prefixe du nom de la pièce jointe"
|
|
||||||
|
|
||||||
#. module: event_mail_attachment
|
|
||||||
#: model:ir.model,name:event_mail_attachment.model_mail_template
|
|
||||||
msgid "Email Templates"
|
|
||||||
msgstr "Modèles d'emails"
|
|
||||||
|
|
||||||
#. module: event_mail_attachment
|
|
||||||
#: model:ir.model.fields,help:event_mail_attachment.field_mail_template__event_attachment_name_prefix
|
|
||||||
msgid ""
|
|
||||||
"If there is an attachment in event registration, or in event, with a name "
|
|
||||||
"that starts with this name, it will be attached to the mail."
|
|
||||||
msgstr ""
|
|
@@ -1 +0,0 @@
|
|||||||
from . import mail_template
|
|
@@ -1,50 +0,0 @@
|
|||||||
from odoo import _, api, Command, fields, models
|
|
||||||
from lxml import etree, html
|
|
||||||
|
|
||||||
class MailTemplate(models.Model):
|
|
||||||
_inherit = "mail.template"
|
|
||||||
|
|
||||||
event_attachment_name_prefix = fields.Char('Attachment name prefix', help="If there is an attachment in event registration, or in event, with a name that starts with this name, it will be attached to the mail.")
|
|
||||||
|
|
||||||
|
|
||||||
def generate_email(self, res_ids, fields):
|
|
||||||
res = super(MailTemplate, self).generate_email(res_ids, fields)
|
|
||||||
|
|
||||||
self.ensure_one()
|
|
||||||
multi_mode = True
|
|
||||||
if isinstance(res_ids, int):
|
|
||||||
res_ids = [res_ids]
|
|
||||||
multi_mode = False
|
|
||||||
|
|
||||||
for lang, (template, template_res_ids) in self._classify_per_lang(res_ids).items():
|
|
||||||
#add reports attached to event.registration or event.event from attachment name
|
|
||||||
if template.event_attachment_name_prefix:
|
|
||||||
for res_id in template_res_ids:
|
|
||||||
event_registration = self.env['event.registration'].browse(res_id)
|
|
||||||
attachments = self.env['ir.attachment']
|
|
||||||
for event_attachment_name_prefix in template.event_attachment_name_prefix.split(","):
|
|
||||||
attachments |= self.env['ir.attachment'].search([
|
|
||||||
('res_model','=','event.registration'),
|
|
||||||
('res_id','=',res_id),
|
|
||||||
('name','like',event_attachment_name_prefix)])
|
|
||||||
attachments |= self.env['ir.attachment'].search([
|
|
||||||
('res_model','=','event.event'),
|
|
||||||
('res_id','=',event_registration.event_id.id),
|
|
||||||
('name','like',event_attachment_name_prefix)])
|
|
||||||
|
|
||||||
attachments_res = [(attachment.name, attachment.datas) for attachment in attachments]
|
|
||||||
|
|
||||||
if multi_mode:
|
|
||||||
if res_id in res:
|
|
||||||
if not 'attachments' in res[res_id]:
|
|
||||||
res[res_id]['attachments'] = attachments_res
|
|
||||||
else:
|
|
||||||
res[res_id]['attachments'].extend(attachments_res)
|
|
||||||
else:
|
|
||||||
if not 'attachments' in res:
|
|
||||||
res['attachments'] = attachments_res
|
|
||||||
else:
|
|
||||||
res['attachments'].extend(attachments_res)
|
|
||||||
|
|
||||||
|
|
||||||
return res
|
|
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
<data>
|
|
||||||
<record model="ir.ui.view" id="email_template_form_event_mail_attachment">
|
|
||||||
<field name="name">email.template.form.event.mail.attachment</field>
|
|
||||||
<field name="inherit_id" ref="mail.email_template_form" />
|
|
||||||
<field name="model">mail.template</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="report_template" position="after">
|
|
||||||
<field name="event_attachment_name_prefix" />
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record model="ir.ui.view" id="email_template_tree_event_mail_attachment">
|
|
||||||
<field name="name">email.template.tree.event.mail.attachment</field>
|
|
||||||
<field name="inherit_id" ref="mail.email_template_tree" />
|
|
||||||
<field name="model">mail.template</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="report_name" position="after">
|
|
||||||
<field name="event_attachment_name_prefix" />
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,22 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event mail manual",
|
|
||||||
"version": "16.0.0.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
'summary': 'Add manual send in event communication',
|
|
||||||
'description': """
|
|
||||||
Add manual send in event communication
|
|
||||||
----------------------------------------------------
|
|
||||||
|
|
||||||
""",
|
|
||||||
"category": "",
|
|
||||||
"depends": ["event"],
|
|
||||||
"data": [
|
|
||||||
'views/event_event_views.xml'
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
from . import event_mail
|
|
@@ -1,80 +0,0 @@
|
|||||||
from odoo import _, api, Command, fields, models
|
|
||||||
from lxml import etree, html
|
|
||||||
import logging
|
|
||||||
from odoo.exceptions import MissingError, ValidationError
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class EventMail(models.Model):
|
|
||||||
_inherit = "event.mail"
|
|
||||||
|
|
||||||
notification_type = fields.Selection(selection_add=[('mail_manual', 'Mail (manual)')], ondelete={'mail_manual': 'set default'})
|
|
||||||
|
|
||||||
|
|
||||||
def _selection_template_model_get_mapping(self):
|
|
||||||
return {**super(EventMail, self)._selection_template_model_get_mapping(), 'mail_manual': 'mail.template'}
|
|
||||||
|
|
||||||
|
|
||||||
@api.depends('event_id.date_begin', 'event_id.date_end', 'interval_type', 'interval_unit', 'interval_nbr','notification_type')
|
|
||||||
def _compute_scheduled_date(self):
|
|
||||||
res = super(EventMail, self)._compute_scheduled_date()
|
|
||||||
for scheduler in self:
|
|
||||||
if scheduler.notification_type == 'mail_manual':
|
|
||||||
scheduler.scheduled_date = '2148-12-31'
|
|
||||||
scheduler.interval_type = 'after_sub'
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
|
||||||
def send(self):
|
|
||||||
self.execute()
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
class EventMailRegistration(models.Model):
|
|
||||||
_inherit = 'event.mail.registration'
|
|
||||||
|
|
||||||
|
|
||||||
def execute(self):
|
|
||||||
"""Inherit execute to send mail from schedulers "mail_manual"
|
|
||||||
"""
|
|
||||||
res = super(EventMailRegistration, self).execute()
|
|
||||||
|
|
||||||
todo_manual = self.filtered(lambda reg_mail:
|
|
||||||
not reg_mail.mail_sent and
|
|
||||||
reg_mail.registration_id.state in ['open', 'done'] and
|
|
||||||
reg_mail.scheduler_id.notification_type == 'mail_manual'
|
|
||||||
)
|
|
||||||
done = self.browse()
|
|
||||||
for reg_mail in todo_manual:
|
|
||||||
organizer = reg_mail.scheduler_id.event_id.organizer_id
|
|
||||||
company = self.env.company
|
|
||||||
author = self.env.ref('base.user_root').partner_id
|
|
||||||
if organizer.email:
|
|
||||||
author = organizer
|
|
||||||
elif company.email:
|
|
||||||
author = company.partner_id
|
|
||||||
elif self.env.user.email:
|
|
||||||
author = self.env.user.partner_id
|
|
||||||
|
|
||||||
email_values = {
|
|
||||||
'author_id': author.id,
|
|
||||||
}
|
|
||||||
template = None
|
|
||||||
try:
|
|
||||||
template = reg_mail.scheduler_id.template_ref.exists()
|
|
||||||
except MissingError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not template:
|
|
||||||
_logger.warning("Cannot process ticket %s, because Mail Scheduler %s has reference to non-existent template", reg_mail.registration_id, reg_mail.scheduler_id)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not template.email_from:
|
|
||||||
email_values['email_from'] = author.email_formatted
|
|
||||||
template.send_mail(reg_mail.registration_id.id, email_values=email_values)
|
|
||||||
done |= reg_mail
|
|
||||||
done.write({'mail_sent': True})
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
<data>
|
|
||||||
<record model="ir.ui.view" id="view_event_form_event_mail_manual">
|
|
||||||
<field name="name">event.event.form.event.mail.manual</field>
|
|
||||||
<field name="inherit_id" ref="event.view_event_form" />
|
|
||||||
<field name="model">event.event</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='event_mail_ids']/tree/field[@name='mail_state']" position="after">
|
|
||||||
<button
|
|
||||||
name="send"
|
|
||||||
type="object"
|
|
||||||
icon="fa-bullhorn"
|
|
||||||
attrs="{'invisible':[('notification_type','!=','mail_manual')]}"
|
|
||||||
confirm="Send mail to all attendees ?" />
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//field[@name='event_mail_ids']/tree/field[@name='interval_nbr']" position="attributes">
|
|
||||||
<attribute name="attrs">{'readonly':['|',('interval_unit','=','now'),('notification_type','=','mail_manual')]}</attribute>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//field[@name='event_mail_ids']/tree/field[@name='interval_unit']" position="attributes">
|
|
||||||
<attribute name="attrs">{'readonly':[('notification_type','=','mail_manual')]}</attribute>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//field[@name='event_mail_ids']/tree/field[@name='interval_type']" position="attributes">
|
|
||||||
<attribute name="attrs">{'readonly':[('notification_type','=','mail_manual')]}</attribute>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,22 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event sequences",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
"category": "",
|
|
||||||
"depends": ["event", "website_event_track"],
|
|
||||||
"data": [
|
|
||||||
'security/ir.model.access.csv',
|
|
||||||
'views/event_sequence_views.xml',
|
|
||||||
'views/event_track_views.xml',
|
|
||||||
'views/event_event_views.xml',
|
|
||||||
'views/event_sequence_menu.xml',
|
|
||||||
'data/event_sequence_data.xml',
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
}
|
|
@@ -1,62 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<record forcecreate="True" id="event_sequence_1" model="event.sequence">
|
|
||||||
<field name="name">Séquence 1</field>
|
|
||||||
<field name="sequence">1</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_2" model="event.sequence">
|
|
||||||
<field name="name">Séquence 2</field>
|
|
||||||
<field name="sequence">2</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_3" model="event.sequence">
|
|
||||||
<field name="name">Séquence 3</field>
|
|
||||||
<field name="sequence">3</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_4" model="event.sequence">
|
|
||||||
<field name="name">Séquence 4</field>
|
|
||||||
<field name="sequence">4</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_5" model="event.sequence">
|
|
||||||
<field name="name">Séquence 5</field>
|
|
||||||
<field name="sequence">5</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_6" model="event.sequence">
|
|
||||||
<field name="name">Séquence 6</field>
|
|
||||||
<field name="sequence">6</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_7" model="event.sequence">
|
|
||||||
<field name="name">Séquence 7</field>
|
|
||||||
<field name="sequence">7</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_8" model="event.sequence">
|
|
||||||
<field name="name">Séquence 8</field>
|
|
||||||
<field name="sequence">8</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_9" model="event.sequence">
|
|
||||||
<field name="name">Séquence 9</field>
|
|
||||||
<field name="sequence">9</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_10" model="event.sequence">
|
|
||||||
<field name="name">Séquence 10</field>
|
|
||||||
<field name="sequence">10</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_11" model="event.sequence">
|
|
||||||
<field name="name">Séquence 11</field>
|
|
||||||
<field name="sequence">11</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record forcecreate="True" id="event_sequence_12" model="event.sequence">
|
|
||||||
<field name="name">Séquence 12</field>
|
|
||||||
<field name="sequence">12</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
@@ -1,62 +0,0 @@
|
|||||||
# Translation of Odoo Server.
|
|
||||||
# This file contains the translation of the following modules:
|
|
||||||
# * event_sequence
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: Odoo Server 16.0\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2024-03-06 11:11+0000\n"
|
|
||||||
"PO-Revision-Date: 2024-03-06 11:11+0000\n"
|
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: \n"
|
|
||||||
"Plural-Forms: \n"
|
|
||||||
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_event__current_sequence_id
|
|
||||||
msgid "Current sequence"
|
|
||||||
msgstr "Séquence en cours"
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_sequence__display_name
|
|
||||||
msgid "Display Name"
|
|
||||||
msgstr "Nom"
|
|
||||||
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_event__sequence_number
|
|
||||||
msgid "Number of sequences"
|
|
||||||
msgstr "Nombre de séquences"
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_sequence__sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_track__sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_track__sequence_id
|
|
||||||
msgid "Sequence"
|
|
||||||
msgstr "Séquence"
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model:ir.actions.act_window,name:event_sequence.event_sequence_action
|
|
||||||
#: model:ir.ui.menu,name:event_sequence.event_sequence_menu
|
|
||||||
msgid "Sequences"
|
|
||||||
msgstr "Séquences"
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model_terms:ir.ui.view,arch_db:event_sequence.view_event_form_event_sequence
|
|
||||||
msgid "Current sequence"
|
|
||||||
msgstr "Séquence en cours"
|
|
||||||
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model_terms:ir.ui.view,arch_db:event_sequence.view_event_track_by_sequence_kanban
|
|
||||||
msgid "hours"
|
|
||||||
msgstr "heures"
|
|
||||||
|
|
||||||
#. module: event_sequence
|
|
||||||
#: model:ir.model.fields,field_description:event_sequence.field_event_sequence__name
|
|
||||||
msgid "name"
|
|
||||||
msgstr "nom"
|
|
@@ -1,3 +0,0 @@
|
|||||||
from . import event_sequence
|
|
||||||
from . import event_track
|
|
||||||
from . import event_event
|
|
@@ -1,9 +0,0 @@
|
|||||||
from odoo import _, api, Command, fields, models
|
|
||||||
from lxml import etree, html
|
|
||||||
from odoo.tools import format_time
|
|
||||||
|
|
||||||
class EventEvent(models.Model):
|
|
||||||
_inherit = "event.event"
|
|
||||||
|
|
||||||
sequence_number = fields.Integer('Number of sequences', default="5")
|
|
||||||
current_sequence_id = fields.Many2one('event.sequence', 'Current sequence')
|
|
@@ -1,9 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models
|
|
||||||
|
|
||||||
|
|
||||||
class EventSequence(models.Model):
|
|
||||||
_name = "event.sequence"
|
|
||||||
|
|
||||||
name = fields.Char("name")
|
|
||||||
sequence = fields.Integer("Sequence") #for sorting
|
|
@@ -1,32 +0,0 @@
|
|||||||
from odoo import _, api, Command, fields, models
|
|
||||||
from lxml import etree, html
|
|
||||||
from odoo.tools import format_time
|
|
||||||
|
|
||||||
class EventTrack(models.Model):
|
|
||||||
_inherit = "event.track"
|
|
||||||
|
|
||||||
sequence_id = fields.Many2one('event.sequence', 'Sequence', group_expand='_read_group_stage_ids')
|
|
||||||
sequence = fields.Integer('Sequence') #for sorting
|
|
||||||
|
|
||||||
@api.model_create_multi
|
|
||||||
def create(self, vals_list):
|
|
||||||
if vals_list and 'sequence' not in vals_list[0]:
|
|
||||||
vals_list[0]['sequence'] = 999
|
|
||||||
tracks = super(EventTrack, self).create(vals_list)
|
|
||||||
return tracks
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _read_group_stage_ids(self, stages, domain, order):
|
|
||||||
event_id = None
|
|
||||||
for d in domain:
|
|
||||||
if d[0] == "event_id" and d[1] == "=" and d[2]:
|
|
||||||
event_id = d[2]
|
|
||||||
|
|
||||||
if event_id:
|
|
||||||
event = self.env['event.event'].browse(event_id)
|
|
||||||
return stages.search([], order="sequence", limit=event.sequence_number)
|
|
||||||
|
|
||||||
return stages.search([], order="sequence")
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
|
||||||
access_event_sequence,event.sequence,model_event_sequence,event.group_event_manager,1,1,1,1
|
|
|
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<record model="ir.ui.view" id="view_event_form_event_sequence">
|
|
||||||
<field name="name">event.event.form.event.sequence</field>
|
|
||||||
<field name="model">event.event</field>
|
|
||||||
<field name="inherit_id" ref="event.view_event_form" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<label for="date_begin" position="before">
|
|
||||||
<field name="sequence_number" />
|
|
||||||
</label>
|
|
||||||
<h1 position="after">
|
|
||||||
<label for="current_sequence_id" string="Current sequence"/>
|
|
||||||
<h4><field class="text-break" name="current_sequence_id" style="width:150px;" /></h4>
|
|
||||||
</h1>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<menuitem id="event_sequence_menu"
|
|
||||||
name="Sequences"
|
|
||||||
action="event_sequence_action"
|
|
||||||
parent="event.menu_event_configuration"
|
|
||||||
sequence="31"/>
|
|
||||||
</odoo>
|
|
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<record model="ir.ui.view" id="view_event_sequence_tree">
|
|
||||||
<field name="name">event.sequence</field>
|
|
||||||
<field name="model">event.sequence</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<tree editable="top">
|
|
||||||
<field name="sequence" widget="handle" />
|
|
||||||
<field name="name" />
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="event_sequence_action" model="ir.actions.act_window">
|
|
||||||
<field name="name">Sequences</field>
|
|
||||||
<field name="res_model">event.sequence</field>
|
|
||||||
<field name="view_mode">tree</field>
|
|
||||||
<field name="view_id" ref="view_event_sequence_tree"/>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
@@ -1,68 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<record model="ir.ui.view" id="view_event_track_by_sequence_kanban">
|
|
||||||
<field name="name">event.track.by.sequence.kanban</field>
|
|
||||||
<field name="model">event.track</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<kanban default_order="sequence" group_create="false" default_group_by="sequence_id" quick_create_view="website_event_track.event_track_view_form_quick_create">
|
|
||||||
<field name="color"/>
|
|
||||||
<field name="partner_id"/>
|
|
||||||
<field name="sequence_id" options="{'create':false}" />
|
|
||||||
<field name="stage_id" options='{"group_by_tooltip": {"description": "Description"}}'/>
|
|
||||||
<field name="website_url"/>
|
|
||||||
<field name="activity_ids"/>
|
|
||||||
<field name="activity_state"/>
|
|
||||||
<field name="legend_blocked"/>
|
|
||||||
<field name="legend_normal"/>
|
|
||||||
<field name="legend_done"/>
|
|
||||||
<templates>
|
|
||||||
<progressbar field="kanban_state" colors='{"done": "success", "blocked": "danger"}'/>
|
|
||||||
<t t-name="kanban-box">
|
|
||||||
<div t-attf-class="{{!selection_mode ? 'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) : ''}} oe_kanban_card oe_kanban_global_click">
|
|
||||||
<div class="o_dropdown_kanban dropdown" groups="base.group_user">
|
|
||||||
|
|
||||||
<a role="button" class="dropdown-toggle o-no-caret btn" data-bs-toggle="dropdown" href="#" aria-label="Dropdown menu" title="Dropdown menu">
|
|
||||||
<span class="fa fa-ellipsis-v"/>
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-menu" role="menu">
|
|
||||||
<a role="menuitem" t-att-href="record.website_url.value" class="dropdown-item">View Track</a>
|
|
||||||
<t t-if="widget.editable"><a role="menuitem" type="edit" class="dropdown-item">Edit Track</a></t>
|
|
||||||
<t t-if="widget.deletable"><a role="menuitem" type="delete" class="dropdown-item">Delete</a></t>
|
|
||||||
<ul class="oe_kanban_colorpicker" data-field="color"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="oe_kanban_content">
|
|
||||||
<div class="o_kanban_record_top">
|
|
||||||
<h4 class="o_kanban_record_title"><field name="name"/></h4>
|
|
||||||
</div>
|
|
||||||
<div class="o_kanban_record_body">
|
|
||||||
<t t-if="duration"><field name="duration" widget="float_time"/> hours</t>
|
|
||||||
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
|
||||||
</div>
|
|
||||||
<div class="o_kanban_record_bottom">
|
|
||||||
<div class="oe_kanban_bottom_left">
|
|
||||||
<field name="priority" widget="priority"/>
|
|
||||||
<field name="activity_ids" widget="kanban_activity"/>
|
|
||||||
</div>
|
|
||||||
<div class="oe_kanban_bottom_right">
|
|
||||||
<field name="kanban_state" widget="state_selection" groups="base.group_user"/>
|
|
||||||
<img t-att-src="kanban_image('res.partner', 'avatar_128', record.partner_id.raw_value)"
|
|
||||||
t-att-title="record.partner_id.value" t-att-alt="record.partner_id.value"
|
|
||||||
class="oe_kanban_avatar"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</templates>
|
|
||||||
</kanban>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record model="ir.actions.act_window.view" id="action_event_track_from_event_kanban">
|
|
||||||
<field name="sequence" eval="1"/>
|
|
||||||
<field name="view_mode">kanban</field>
|
|
||||||
<field name="act_window_id" ref="website_event_track.action_event_track_from_event"/>
|
|
||||||
<field name="view_id" ref="event_sequence.view_event_track_by_sequence_kanban"/>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,17 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event speakers",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
"category": "",
|
|
||||||
"depends": ["website_event_track"],
|
|
||||||
"data": [
|
|
||||||
'views/event_track_views.xml',
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
# Translation of Odoo Server.
|
|
||||||
# This file contains the translation of the following modules:
|
|
||||||
# * event_speaker
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: Odoo Server 16.0\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2023-09-19 14:31+0000\n"
|
|
||||||
"PO-Revision-Date: 2023-09-19 14:31+0000\n"
|
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: \n"
|
|
||||||
"Plural-Forms: \n"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#. module: event_speaker
|
|
||||||
#: model:ir.model.fields,field_description:event_speaker.field_event_event__speakers
|
|
||||||
#: model_terms:ir.ui.view,arch_db:event_speaker.view_event_form_event_speaker
|
|
||||||
msgid "Speakers"
|
|
||||||
msgstr "Intervenants"
|
|
@@ -1,2 +0,0 @@
|
|||||||
from . import event_track
|
|
||||||
#from . import event_event
|
|
@@ -1,10 +0,0 @@
|
|||||||
# 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(
|
|
||||||
'res.partner', string="Speakers", domain="[('is_company','=',False)]"
|
|
||||||
)
|
|
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<!-- Event form -->
|
|
||||||
<record model="ir.ui.view" id="view_event_track_form_event_speaker">
|
|
||||||
<field name="name">event.track.form.event.speaker</field>
|
|
||||||
<field name="model">event.track</field>
|
|
||||||
<field name="inherit_id" ref="website_event_track.view_event_track_form" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<page name="speaker" position="inside">
|
|
||||||
<field name="speaker_ids" />
|
|
||||||
</page>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,25 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event track calendar event",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
"category": "",
|
|
||||||
'summary': 'Replace date of event track with list of calendar events',
|
|
||||||
'description': """
|
|
||||||
Replace date of event track with list of calendar events
|
|
||||||
----------------------------------------------------
|
|
||||||
* Create calendar events on event track form
|
|
||||||
* Sync calendar event attendees with event track registration
|
|
||||||
|
|
||||||
""",
|
|
||||||
"depends": ["website_event_track","calendar"],
|
|
||||||
"data": [
|
|
||||||
"views/event_track_views.xml"
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
}
|
|
@@ -1,4 +0,0 @@
|
|||||||
from . import calendar_event
|
|
||||||
from . import event_track
|
|
||||||
from . import event_registration
|
|
||||||
from . import event_event
|
|
@@ -1,17 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api, Command
|
|
||||||
|
|
||||||
|
|
||||||
class CalendarEvent(models.Model):
|
|
||||||
_inherit = 'calendar.event'
|
|
||||||
|
|
||||||
event_track_id = fields.Many2one('event.track', "Event track")
|
|
||||||
|
|
||||||
@api.model_create_multi
|
|
||||||
def create(self, vals_list):
|
|
||||||
res = super(CalendarEvent,self).create(vals_list)
|
|
||||||
for event in res:
|
|
||||||
if event.event_track_id:
|
|
||||||
event.event_track_id.sync_calendar_event()
|
|
||||||
|
|
||||||
|
|
@@ -1,16 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api, Command
|
|
||||||
import logging
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class EventEvent(models.Model):
|
|
||||||
_inherit = "event.event"
|
|
||||||
|
|
||||||
def write(self, vals):
|
|
||||||
_logger.warning("call write...")
|
|
||||||
res = super().write(vals)
|
|
||||||
for event in self:
|
|
||||||
for track in event.track_ids:
|
|
||||||
track.sync_calendar_event()
|
|
||||||
_logger.warning("called !")
|
|
||||||
return res
|
|
@@ -1,25 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api, Command
|
|
||||||
import logging
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class EventRegistration(models.Model):
|
|
||||||
_inherit = "event.registration"
|
|
||||||
|
|
||||||
def write(self, vals):
|
|
||||||
_logger.warning("call write...")
|
|
||||||
res = super(EventRegistration,self).write(vals)
|
|
||||||
_logger.warning("Super Write OK")
|
|
||||||
for registration in self:
|
|
||||||
for track in registration.event_id.track_ids:
|
|
||||||
track.sync_calendar_event()
|
|
||||||
_logger.warning("called !")
|
|
||||||
return res
|
|
||||||
|
|
||||||
@api.model_create_multi
|
|
||||||
def create(self, vals_list):
|
|
||||||
res = super(EventRegistration, self).create(vals_list)
|
|
||||||
for registration in res:
|
|
||||||
for track in registration.event_id.track_ids:
|
|
||||||
track.sync_calendar_event()
|
|
||||||
return res
|
|
@@ -1,73 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api, Command
|
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class EventTrack(models.Model):
|
|
||||||
_inherit = "event.track"
|
|
||||||
|
|
||||||
calendar_event_ids = fields.One2many('calendar.event', 'event_track_id', 'Days')
|
|
||||||
date = fields.Datetime(compute="_compute_date")
|
|
||||||
|
|
||||||
def _compute_date(self):
|
|
||||||
"""Date become a field computed from first calendar event date
|
|
||||||
"""
|
|
||||||
for event_track in self:
|
|
||||||
if event_track.calendar_event_ids:
|
|
||||||
event_track.date = event_track.calendar_event_ids.sorted(key=lambda r: r.start)[0].start
|
|
||||||
else:
|
|
||||||
event_track.date = None
|
|
||||||
|
|
||||||
def get_calendar_event_values(self):
|
|
||||||
"""return default values of calendar events
|
|
||||||
"""
|
|
||||||
return {
|
|
||||||
'partner_ids':[Command.set(self.get_calendar_event_partner_value())],
|
|
||||||
'location':self.location_id.name if self.location_id else '',
|
|
||||||
'user_id':self.user_id.id
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_calendar_event_partner_value(self):
|
|
||||||
"""Compute list of partner ids for calendar event
|
|
||||||
"""
|
|
||||||
# compute list of attendees
|
|
||||||
partner_ids = []
|
|
||||||
|
|
||||||
# add event track contact
|
|
||||||
if self.partner_id:
|
|
||||||
partner_ids.append(self.partner_id.id)
|
|
||||||
|
|
||||||
# add event registration attendees
|
|
||||||
partner_ids.extend([registration.partner_id.id for registration in self.event_id.registration_ids if registration.partner_id])
|
|
||||||
|
|
||||||
return partner_ids
|
|
||||||
|
|
||||||
|
|
||||||
def sync_calendar_event(self):
|
|
||||||
"""synchronize calendar event values with event track data
|
|
||||||
"""
|
|
||||||
_logger.warning("sync_calendar_event...")
|
|
||||||
for track in self:
|
|
||||||
track.calendar_event_ids.write(track.get_calendar_event_values())
|
|
||||||
_logger.warning("sync_calendar_event done !")
|
|
||||||
|
|
||||||
|
|
||||||
@api.model_create_multi
|
|
||||||
def create(self, vals_list):
|
|
||||||
"""
|
|
||||||
after creation of event track synchronise calendar event values
|
|
||||||
"""
|
|
||||||
res = super(EventTrack, self).create(vals_list)
|
|
||||||
res.sync_calendar_event()
|
|
||||||
return res
|
|
||||||
|
|
||||||
def write(self, vals):
|
|
||||||
"""
|
|
||||||
after modification of event track synchronise calendar event values
|
|
||||||
"""
|
|
||||||
res = super().write(vals)
|
|
||||||
self.sync_calendar_event()
|
|
||||||
return res
|
|
@@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<record model="ir.ui.view" id="view_event_track_form_ctl_training_customization">
|
|
||||||
<field name="name">event.track.form.ctl.training.customization</field>
|
|
||||||
<field name="inherit_id" ref="website_event_track.view_event_track_form" />
|
|
||||||
<field name="model">event.track</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<!--
|
|
||||||
Replace date with calendar events
|
|
||||||
-->
|
|
||||||
<field name="date" position="replace" />
|
|
||||||
<page name="speaker" position="before">
|
|
||||||
<page name="calendar_events" string="Dates">
|
|
||||||
<field name="calendar_event_ids" context="{'default_name':name}" colspan="2">
|
|
||||||
<tree default_order="start,stop">
|
|
||||||
<field name="name" string="Name" invisible="1" />
|
|
||||||
<field name="start" string="From" />
|
|
||||||
<field name="stop" string="To" />
|
|
||||||
<field name="description" />
|
|
||||||
</tree>
|
|
||||||
<form>
|
|
||||||
<group>
|
|
||||||
<field name="name" string="Name" invisible="True" />
|
|
||||||
<label for="start" string="Date"/>
|
|
||||||
<div class="o_row">
|
|
||||||
<field name="start" widget="daterange" nolabel="1" class="oe_inline" options="{'related_end_date': 'stop'}"/>
|
|
||||||
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow"/>
|
|
||||||
<field name="stop" widget="daterange" nolabel="1" class="oe_inline" options="{'related_start_date': 'start'}"/>
|
|
||||||
</div>
|
|
||||||
<field name="description" />
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</page>
|
|
||||||
</page>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,18 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event track calendar event - event speakers",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
"category": "",
|
|
||||||
'summary': 'Event track calendar event adaptation when event_speaker module installed',
|
|
||||||
"depends": ["event_track_calendar_event","event_speaker"],
|
|
||||||
"data": [
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
"auto_install":True
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
from . import event_track
|
|
@@ -1,15 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api, Command
|
|
||||||
|
|
||||||
|
|
||||||
class EventTrack(models.Model):
|
|
||||||
_inherit = "event.track"
|
|
||||||
|
|
||||||
def get_calendar_event_partner_value(self):
|
|
||||||
"""Add speaker ids to calendar event partners
|
|
||||||
"""
|
|
||||||
res = super(EventTrack, self).get_calendar_event_partner_value()
|
|
||||||
res.extend(self.speaker_ids.ids)
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,29 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event track location in calendar event",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
"category": "",
|
|
||||||
'summary': 'Link event tracks locations to calendar event',
|
|
||||||
'description': """
|
|
||||||
Link event tracks locations to calendar event
|
|
||||||
----------------------------------------------------
|
|
||||||
* Add Partner field on event track location
|
|
||||||
* Add partner "location" to calendar event
|
|
||||||
* Update calendar event if event track location change (or partner in event track location)
|
|
||||||
* Alert if location is used
|
|
||||||
|
|
||||||
|
|
||||||
""",
|
|
||||||
"depends": ["website_event_track","calendar"],
|
|
||||||
"data": [
|
|
||||||
'views/event_track_location_views.xml',
|
|
||||||
'views/event_track_views.xml'
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
}
|
|
@@ -1,2 +0,0 @@
|
|||||||
from . import event_track
|
|
||||||
from . import event_track_location
|
|
@@ -1,51 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api, Command, _
|
|
||||||
from datetime import timedelta
|
|
||||||
from odoo.tools import format_date
|
|
||||||
|
|
||||||
|
|
||||||
class EventTrack(models.Model):
|
|
||||||
_inherit = "event.track"
|
|
||||||
|
|
||||||
|
|
||||||
location_already_in_use = fields.Boolean('Location already in use', compute='_compute_location_already_in_use')
|
|
||||||
location_already_in_use_message = fields.Text(compute='_compute_location_already_in_use')
|
|
||||||
|
|
||||||
@api.depends('date', 'duration', 'location_id')
|
|
||||||
def _compute_location_already_in_use(self):
|
|
||||||
for track in self:
|
|
||||||
location_already_in_use = False
|
|
||||||
location_already_in_use_message = ""
|
|
||||||
|
|
||||||
for calendar_event in track.calendar_event_ids:
|
|
||||||
if track.location_id and calendar_event.start:
|
|
||||||
|
|
||||||
#search if other calendar event exists for same day on same location
|
|
||||||
search_other_calendar_events = [('event_track_id.location_id','=',track.location_id.id),('start','>=',calendar_event.start.replace(hour=0,minute=0)),('start','<=',calendar_event.start.replace(hour=23,minute=59))]
|
|
||||||
|
|
||||||
if track.id or track.id.origin:
|
|
||||||
search_other_calendar_events.append(('event_track_id','!=',track.id or track.id.origin))
|
|
||||||
other_calendar_events = self.env["calendar.event"].search(search_other_calendar_events)
|
|
||||||
|
|
||||||
if other_calendar_events:
|
|
||||||
location_already_in_use = True
|
|
||||||
for other_calendar_event in other_calendar_events:
|
|
||||||
location_already_in_use_message += other_calendar_event.event_track_id.event_id.name+" - "+\
|
|
||||||
other_calendar_event.event_track_id.name+\
|
|
||||||
" ("+format_date(self.env, other_calendar_event.start)+")"+"\n"
|
|
||||||
|
|
||||||
track.location_already_in_use = location_already_in_use
|
|
||||||
track.location_already_in_use_message = location_already_in_use_message
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_calendar_event_partner_value(self):
|
|
||||||
"""Add event track location partner to list of partner ids
|
|
||||||
"""
|
|
||||||
|
|
||||||
res = super(EventTrack, self).get_calendar_event_partner_value()
|
|
||||||
if self.location_id and self.location_id.partner_id:
|
|
||||||
res.append(self.location_id.partner_id.id)
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
@@ -1,17 +0,0 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
||||||
from odoo import fields, models, api
|
|
||||||
|
|
||||||
|
|
||||||
class EventTrackLocation(models.Model):
|
|
||||||
_inherit = 'event.track.location'
|
|
||||||
|
|
||||||
partner_id = fields.Many2one('res.partner', 'Address', domain="[('is_company','=',True)]")
|
|
||||||
|
|
||||||
def write(self, vals):
|
|
||||||
"""update calendar events related to event tracks if partner change
|
|
||||||
"""
|
|
||||||
res = super(EventTrackLocation, self).write(vals)
|
|
||||||
if 'partner_id' in vals:
|
|
||||||
event_tracks = self.env['event.track'].search([('location_id','in',self.ids)])
|
|
||||||
event_tracks.sync_calendar_event()
|
|
||||||
return res
|
|
@@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<!-- EVENTS/CONFIGURATION/EVENT locations -->
|
|
||||||
<record model="ir.ui.view" id="view_event_location_form_inherit_event_track_location_calendar">
|
|
||||||
<field name="name">Event Locations inherit for event track location calendar</field>
|
|
||||||
<field name="model">event.track.location</field>
|
|
||||||
<field name="inherit_id" ref="website_event_track.view_event_location_form" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='name']" position="after">
|
|
||||||
<field name="partner_id" />
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record model="ir.ui.view" id="view_event_location_tree_inherit_event_track_location_calendar">
|
|
||||||
<field name="name">Event Location</field>
|
|
||||||
<field name="model">event.track.location</field>
|
|
||||||
<field name="inherit_id" ref="website_event_track.view_event_location_tree" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='name']" position="after">
|
|
||||||
<field name="partner_id" />
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
|
|
||||||
</odoo>
|
|
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<odoo>
|
|
||||||
<record model="ir.ui.view" id="view_event_track_form_inherit_event_track_location_calendar">
|
|
||||||
<field name="name">event.track.form inherit for event track location calendar</field>
|
|
||||||
<field name="model">event.track</field>
|
|
||||||
<field name="inherit_id" ref="website_event_track.view_event_track_form" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//header" position="after">
|
|
||||||
<field name="location_already_in_use" invisible="1" />
|
|
||||||
<div attrs="{'invisible':[('location_already_in_use','=',False)]}" class="alert alert-warning mb-0" role="alert">
|
|
||||||
<strong>Location already in use for this date !</strong><field name="location_already_in_use_message" />
|
|
||||||
</div>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
@@ -1,17 +0,0 @@
|
|||||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
|
||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Event type button box",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://www.elabore.coop",
|
|
||||||
"category": "",
|
|
||||||
"depends": ["event"],
|
|
||||||
"data": [
|
|
||||||
'views/event_type_views.xml',
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
<record id="event_type_form_view" model="ir.ui.view">
|
|
||||||
<field name="name">event.type.form</field>
|
|
||||||
<field name="model">event.type</field>
|
|
||||||
<field eval="7" name="priority"/>
|
|
||||||
<field name="inherit_id" ref="event.view_event_type_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<div name="event_type_title" position="before">
|
|
||||||
<div name="button_box" class="oe_button_box" />
|
|
||||||
</div>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
36
show_unusual_days_on_calendar/__manifest__.py
Normal file
36
show_unusual_days_on_calendar/__manifest__.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Copyright 2022 Stéphan Sainléger (Elabore)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "show_unusual_days_on_calendar",
|
||||||
|
"version": "14.0.1.0.0",
|
||||||
|
"author": "Elabore",
|
||||||
|
"website": "https://elabore.coop",
|
||||||
|
"maintainer": "Clément Thomas / Laetitia Da Costa",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"category": "Tools",
|
||||||
|
"summary": "show unusual days such as leaves or holidays on event calendar in the same way it does in hr_leave calendar \n (event in gray background and white borders)",
|
||||||
|
# any module necessary for this one to work correctly
|
||||||
|
"depends": [
|
||||||
|
"calendar",
|
||||||
|
"hr_holidays",
|
||||||
|
],
|
||||||
|
"qweb": [
|
||||||
|
],
|
||||||
|
"external_dependencies": {
|
||||||
|
"python": [],
|
||||||
|
},
|
||||||
|
# always loaded
|
||||||
|
"data": [
|
||||||
|
'views/calendar_event_views.xml',
|
||||||
|
],
|
||||||
|
# only loaded in demonstration mode
|
||||||
|
"demo": [],
|
||||||
|
"js": [],
|
||||||
|
"css": [],
|
||||||
|
"installable": True,
|
||||||
|
# Install this module automatically if all dependency have been previously
|
||||||
|
# and independently installed. Used for synergetic or glue modules.
|
||||||
|
"auto_install": False,
|
||||||
|
"application": False,
|
||||||
|
}
|
1
show_unusual_days_on_calendar/models/__init__.py
Normal file
1
show_unusual_days_on_calendar/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import calendar_event
|
12
show_unusual_days_on_calendar/models/calendar_event.py
Normal file
12
show_unusual_days_on_calendar/models/calendar_event.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
|
from odoo import api, fields, models
|
||||||
|
from datetime import datetime, time
|
||||||
|
|
||||||
|
class CalendarEvent(models.Model):
|
||||||
|
_inherit = 'calendar.event'
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def get_unusual_days(self, date_from, date_to=None):
|
||||||
|
return self.env['hr.leave'].get_unusual_days(date_from, date_to=date_to)
|
15
show_unusual_days_on_calendar/views/calendar_event_views.xml
Normal file
15
show_unusual_days_on_calendar/views/calendar_event_views.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="view_calendar_event_calendar_unusual_days_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">calendar.event.calendar.unusual.days.inherit</field>
|
||||||
|
<field name="model">calendar.event</field>
|
||||||
|
<field name="inherit_id" ref="calendar.view_calendar_event_calendar"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<calendar position="attributes">
|
||||||
|
<attribute name="show_unusual_days">True</attribute>
|
||||||
|
</calendar>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
Reference in New Issue
Block a user