[NEW] first commit for all modules coming from training-tools
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from . import models
|
@@ -0,0 +1,25 @@
|
||||
# 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": "Survey event generation attachment",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Elabore",
|
||||
"website": "https://www.elabore.coop",
|
||||
"category": "",
|
||||
'summary': 'Link Attachments from Surveys to generated event registration',
|
||||
'description': """
|
||||
Link Attachments from Surveys to generated event registration
|
||||
----------------------------------------------------
|
||||
* Create new attachments on event registration creation, based on attached file of survey answer (survey.user_input.line)
|
||||
|
||||
""",
|
||||
"depends": ["survey_base","survey_event_registration_generation"],
|
||||
"data": [
|
||||
|
||||
],
|
||||
"installable": True,
|
||||
"auto_install":True
|
||||
}
|
@@ -0,0 +1 @@
|
||||
from . import survey_user_input
|
@@ -0,0 +1,32 @@
|
||||
|
||||
import logging
|
||||
import textwrap
|
||||
import uuid
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tools import float_is_zero
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SurveyUserInput(models.Model):
|
||||
_inherit = 'survey.user_input'
|
||||
|
||||
def _mark_done(self):
|
||||
"""Copy attachments to event registration"""
|
||||
res = super()._mark_done()
|
||||
for user_input in self:
|
||||
if user_input.survey_id.generate_registration and user_input.registration_id:
|
||||
for user_input_line in user_input.user_input_line_ids:
|
||||
if user_input_line.value_file:
|
||||
self.env['ir.attachment'].create({
|
||||
'res_model':'event.registration',
|
||||
'res_id':user_input.registration_id.id,
|
||||
'name': user_input_line.value_file_fname,
|
||||
'datas': user_input_line.value_file,
|
||||
'type': 'binary'
|
||||
})
|
||||
return res
|
Reference in New Issue
Block a user