Compare commits

24 Commits

Author SHA1 Message Date
1a1d764390 Sync config from odoo-elabore-ci:16.0
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 7m54s
2025-09-17 13:39:57 +00:00
clementthomas
dea7a84bd3 [IMP] survey_event_registration_generation: answer filter on survey question "event" 2023-11-06 17:11:32 +01:00
clementthomas
0c4b367112 [IMP] survey_event_registration_generation: manage multiple training products fields in survey 2023-10-31 12:10:12 +01:00
clementthomas
7bc095e265 [IMP] survey_contact_generation:
generate contacts each time for surveys
2023-10-25 14:26:33 +02:00
clementthomas
2690d69696 [IMP] survey_event_registration_generation:
New type of question : multiple event products
2023-10-24 10:57:55 +02:00
clementthomas
d5a834f3c9 [IMP] survey_crm_generation:
Manage lead description of survey answer with multiple objects
2023-10-24 10:57:13 +02:00
clementthomas
dcd8dbb968 [IMP] survey_event_registration_generation: add event_product_id field in survey.user_input 2023-10-18 14:19:09 +02:00
clementthomas
96464a3f2e [IMP] survey_crm_generation: move survey_user_input_id field in lead form view 2023-10-18 14:18:30 +02:00
clementthomas
e24614f571 [IMP] code comment in several modules 2023-10-04 16:55:29 +02:00
clementthomas
915e2bf583 [IMP] survey_event_registration_generation: add event_id to survey_user_input 2023-10-03 17:41:19 +02:00
clementthomas
cb474958d5 [IMP] survey_event_generation: add event selection in surveys depending on event stage boolean 2023-10-03 12:13:03 +02:00
clementthomas
96d2055903 [IMP] survey_event_registration_generation: several dependant event questions in the same page (ajax) 2023-09-27 18:49:32 +02:00
clementthomas
6203bd95da [FIX] survey_event_registration_generation: ir_model_field access rights 2023-09-25 16:45:56 +02:00
clementthomas
e6c39b8ab4 [IMP] multi_modules: translation and labels 2023-09-20 09:18:47 +02:00
clementthomas
bdc39514a0 [DEL] module not used 2023-09-19 16:30:43 +02:00
clementthomas
9ead22c1c7 [ADD] survey_crm_generation 2023-09-19 16:27:36 +02:00
clementthomas
8b7f9c211a [IMP] survey_event_registration_generation: survey answer display 2023-09-19 15:29:51 +02:00
clementthomas
affaf785ee [ADD] survey_event_speaker_generation 2023-09-19 15:28:26 +02:00
clementthomas
d8b820902a [ADD] event_speaker: add speakers to event 2023-09-19 15:26:52 +02:00
clementthomas
4530fc244c [ADD] survey_event_registration_generation_attachment: add attachment to survey generated event registration 2023-09-19 09:37:43 +02:00
clementthomas
b2a64d2574 [IMP] survey_event_generation: manage case when old registration already exists 2023-09-18 17:41:26 +02:00
clementthomas
a1fb5bc5ca [IMP] survey_event_registration_generation: event registration generation 2023-09-18 16:54:59 +02:00
clementthomas
4baaad2054 [ADD] survey_contact_generation, survey_event_registration_generation 2023-09-12 20:35:16 +02:00
clementthomas
1897ac5a6e new repo from zero 2023-09-11 10:26:38 +02:00
129 changed files with 4247 additions and 2318 deletions

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
# Configuration for known file extensions
[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{json,yml,yaml,rst,md}]
indent_size = 2
# Do not configure editor for libs and autogenerated content
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = false
trim_trailing_whitespace = false

188
.eslintrc.yml Normal file
View File

@@ -0,0 +1,188 @@
env:
browser: true
es6: true
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2019
overrides:
- files:
- "**/*.esm.js"
parserOptions:
sourceType: module
# Globals available in Odoo that shouldn't produce errorings
globals:
_: readonly
$: readonly
fuzzy: readonly
jQuery: readonly
moment: readonly
odoo: readonly
openerp: readonly
owl: readonly
luxon: readonly
# Styling is handled by Prettier, so we only need to enable AST rules;
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
rules:
accessor-pairs: warn
array-callback-return: warn
callback-return: warn
capitalized-comments:
- warn
- always
- ignoreConsecutiveComments: true
ignoreInlineComments: true
complexity:
- warn
- 15
constructor-super: warn
dot-notation: warn
eqeqeq: warn
global-require: warn
handle-callback-err: warn
id-blacklist: warn
id-match: warn
init-declarations: error
max-depth: warn
max-nested-callbacks: warn
max-statements-per-line: warn
no-alert: warn
no-array-constructor: warn
no-caller: warn
no-case-declarations: warn
no-class-assign: warn
no-cond-assign: error
no-const-assign: error
no-constant-condition: warn
no-control-regex: warn
no-debugger: error
no-delete-var: warn
no-div-regex: warn
no-dupe-args: error
no-dupe-class-members: error
no-dupe-keys: error
no-duplicate-case: error
no-duplicate-imports: error
no-else-return: warn
no-empty-character-class: warn
no-empty-function: error
no-empty-pattern: error
no-empty: warn
no-eq-null: error
no-eval: error
no-ex-assign: error
no-extend-native: warn
no-extra-bind: warn
no-extra-boolean-cast: warn
no-extra-label: warn
no-fallthrough: warn
no-func-assign: error
no-global-assign: error
no-implicit-coercion:
- warn
- allow: ["~"]
no-implicit-globals: warn
no-implied-eval: warn
no-inline-comments: warn
no-inner-declarations: warn
no-invalid-regexp: warn
no-irregular-whitespace: warn
no-iterator: warn
no-label-var: warn
no-labels: warn
no-lone-blocks: warn
no-lonely-if: error
no-mixed-requires: error
no-multi-str: warn
no-native-reassign: error
no-negated-condition: warn
no-negated-in-lhs: error
no-new-func: warn
no-new-object: warn
no-new-require: warn
no-new-symbol: warn
no-new-wrappers: warn
no-new: warn
no-obj-calls: warn
no-octal-escape: warn
no-octal: warn
no-param-reassign: warn
no-path-concat: warn
no-process-env: warn
no-process-exit: warn
no-proto: warn
no-prototype-builtins: warn
no-redeclare: warn
no-regex-spaces: warn
no-restricted-globals: warn
no-restricted-imports: warn
no-restricted-modules: warn
no-restricted-syntax: warn
no-return-assign: error
no-script-url: warn
no-self-assign: warn
no-self-compare: warn
no-sequences: warn
no-shadow-restricted-names: warn
no-shadow: warn
no-sparse-arrays: warn
no-sync: warn
no-this-before-super: warn
no-throw-literal: warn
no-undef-init: warn
no-undef: error
no-unmodified-loop-condition: warn
no-unneeded-ternary: error
no-unreachable: error
no-unsafe-finally: error
no-unused-expressions: error
no-unused-labels: error
no-unused-vars: error
no-use-before-define: error
no-useless-call: warn
no-useless-computed-key: warn
no-useless-concat: warn
no-useless-constructor: warn
no-useless-escape: warn
no-useless-rename: warn
no-void: warn
no-with: warn
operator-assignment: [error, always]
prefer-const: warn
radix: warn
require-yield: warn
sort-imports: warn
spaced-comment: [error, always]
strict: [error, function]
use-isnan: error
valid-jsdoc:
- warn
- prefer:
arg: param
argument: param
augments: extends
constructor: class
exception: throws
func: function
method: function
prop: property
return: returns
virtual: abstract
yield: yields
preferType:
array: Array
bool: Boolean
boolean: Boolean
number: Number
object: Object
str: String
string: String
requireParamDescription: false
requireReturn: false
requireReturnDescription: false
requireReturnType: false
valid-typeof: warn
yoda: warn

View File

@@ -0,0 +1,42 @@
name: pre-commit
on:
pull_request:
branches:
- "16.0*"
jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
# - uses: actions/cache@v4
# with:
# path: ~/.cache/pre-commit
# key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always
env:
# Consider valid a PR that changes README fragments but doesn't
# change the README.rst file itself. It's not really a problem
# because the bot will update it anyway after merge. This way, we
# lower the barrier for functional contributors that want to fix the
# readme fragments, while still letting developers get README
# auto-generated (which also helps functionals when using runboat).
# DOCS https://pre-commit.com/#temporarily-disabling-hooks
SKIP: oca-gen-addon-readme
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi

150
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,150 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# Don't bother non-technical authors with formatting issues in docs
readme/.*\.(rst|md)$|
# Ignore build and dist directories in addons
/build/|/dist/|
# Ignore test files in addons
/tests/samples/.*|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
node: "16.17.0"
repos:
- repo: local
hooks:
# These files are most likely copier diff rejection junks; if found,
# review them manually, fix the problem (if needed) and remove them
- id: forbidden-files
name: forbidden files
entry: found forbidden files; remove them
language: fail
files: "\\.rej$"
- id: en-po-files
name: en.po files cannot exist
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
rev: f9b919b9868143135a9c9cb03021089cabba8223
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
entry:
bash -c 'oca-fix-manifest-website "https://git.elabore.coop/elabore/$(basename
$(git rev-parse --show-toplevel))"'
- id: oca-gen-addon-readme
entry:
bash -c 'oca-gen-addon-readme
--addons-dir=.
--branch=$(git symbolic-ref
refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@")
--repo-name=$(basename $(git rev-parse --show-toplevel))
--org-name="Elabore"
--if-source-changed --keep-source-digest'
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.1.4
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
args:
- --disable=po-pretty-format
- repo: local
hooks:
- id: prettier
name: prettier (with plugin-xml)
entry: prettier
args:
- --write
- --list-different
- --ignore-unknown
types: [text]
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
language: node
additional_dependencies:
- "prettier@2.7.1"
- "@prettier/plugin-xml@2.2.0"
- repo: local
hooks:
- id: eslint
name: eslint
entry: eslint
args:
- --color
- --fix
verbose: true
types: [javascript]
language: node
additional_dependencies:
- "eslint@8.24.0"
- "eslint-plugin-jsdoc@"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
# exclude files where underlines are not distinguishable from merge conflicts
exclude: /README\.rst$|^docs/.*\.rst$
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.7
hooks:
- id: docformatter
args: [
"--in-place", # modify the files
"--recursive", # run on all the files
"--wrap-summaries",
"88", # max length of 1st line
"--wrap-descriptions",
"88", # max length of other lines
"--pre-summary-newline", # new line before a long summary
"--make-summary-multi-line", # force summary on multilines
]
additional_dependencies: ["tomli"] # if Python <3.11
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: v9.1.3
hooks:
- id: pylint_odoo
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
- id: pylint_odoo
args:
- --rcfile=.pylintrc-mandatory

8
.prettierrc.yml Normal file
View File

@@ -0,0 +1,8 @@
# Defaults for all prettier-supported languages.
# Prettier will complete this with settings from .editorconfig file.
bracketSpacing: false
printWidth: 88
proseWrap: always
semi: true
trailingComma: "es5"
xmlWhitespaceSensitivity: "strict"

123
.pylintrc Normal file
View File

@@ -0,0 +1,123 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=Elabore
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid-odoo-versions=16.0
[MESSAGES CONTROL]
disable=all
# This .pylintrc contains optional AND mandatory checks and is meant to be
# loaded in an IDE to have it check everything, in the hope this will make
# optional checks more visible to contributors who otherwise never look at a
# green travis to see optional checks that failed.
# .pylintrc-mandatory containing only mandatory checks is used the pre-commit
# config as a blocking check.
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
create-user-wo-reset-password,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
redefined-builtin,
too-complex,
unnecessary-utf8-coding-comment
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

98
.pylintrc-mandatory Normal file
View File

@@ -0,0 +1,98 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=Elabore
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid-odoo-versions=16.0
[MESSAGES CONTROL]
disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

31
.ruff.toml Normal file
View File

@@ -0,0 +1,31 @@
target-version = "py310"
fix = true
[lint]
extend-select = [
"B",
"C90",
"E501", # line too long (default 88)
"I", # isort
"UP", # pyupgrade
]
extend-safe-fixes = ["UP008"]
exclude = ["setup/*"]
[format]
exclude = ["setup/*"]
[lint.per-file-ignores]
"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py
"__manifest__.py" = ["B018"] # useless expression
[lint.isort]
section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"]
[lint.isort.sections]
"odoo" = ["odoo"]
"odoo-addons" = ["odoo.addons"]
[lint.mccabe]
max-complexity = 16

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,17 @@
# 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": ["event"],
"data": [
'views/event_event_views.xml',
],
"installable": True,
}

24
event_speaker/i18n/fr.po Normal file
View File

@@ -0,0 +1,24 @@
# 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"

View File

@@ -0,0 +1 @@
from . import event_event

View File

@@ -0,0 +1,10 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class EventEvent(models.Model):
_inherit = "event.event"
speakers = fields.Many2many(
'res.partner', string="Speakers"
)

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Event form -->
<record model="ir.ui.view" id="view_event_form_event_speaker">
<field name="name">event.event.form.event.speaker</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form" />
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Speakers">
<field name="speakers" />
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,91 +0,0 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=============
Learning Base
=============
Base module to add training management to odoo
Installation
============
To install this module, you need to:
#. Do this ...
Configuration
=============
To configure this module, you need to:
#. Go to ...
.. figure:: path/to/local/image.png
:alt: alternative description
:width: 600 px
Usage
=====
To use this module, you need to:
#. Go to ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch}
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
Known issues / Roadmap
======================
* ...
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Firstname Lastname <email.address@example.org>
* Second Person <second.person@example.org>
Funders
-------
The development of this module has been financially supported by:
* Company 1 name
* Company 2 name
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -1,2 +0,0 @@
from . import models
from . import controler

View File

@@ -1,33 +0,0 @@
# -*- coding: utf-8 -*-
{
"name": 'Learning Base',
"version": "16.0.0.0.0",
"depends": [
#'__export__',
'base',
'event',
'sale',
'product',
'website',
'website_sale',
'event_sale',
'partner_firstname',
'product',
'website_event_sale',
'purchase',
],
"author": "Nicolas JEUDY, Odoo Community Association (OCA)",
"installable": True,
"data": [
'security/learning_security.xml',
'security/ir.model.access.csv',
'ir_actions_act_window_records.xml',
'ir_ui_menu_records.xml',
'views/product_template.xml',
'views/event_event.xml',
'views/res_company.xml',
'views/res_partner.xml',
'views/template.xml',
],
}

View File

@@ -1 +0,0 @@
from . import main

View File

@@ -1,343 +0,0 @@
import json
import logging
from werkzeug.exceptions import Forbidden, NotFound
import werkzeug
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from odoo import fields, http, tools, _
from odoo.http import request
from odoo.addons.http_routing.models.ir_http import slug
from odoo.addons.website.controllers.main import QueryURL
from odoo.exceptions import ValidationError
from odoo.addons.website.controllers.main import Website
from odoo.addons.website_form_project.controllers.main import WebsiteForm
from odoo.addons.website_event.controllers.main import WebsiteEventController
from odoo.osv import expression
_logger = logging.getLogger(__name__)
PPG = 20 # Products Per Page
PPR = 4 # Products Per Row
class TableCompute(object):
def __init__(self):
self.table = {}
def _check_place(self, posx, posy, sizex, sizey):
res = True
for y in range(sizey):
for x in range(sizex):
if posx + x >= PPR:
res = False
break
row = self.table.setdefault(posy + y, {})
if row.setdefault(posx + x) is not None:
res = False
break
for x in range(PPR):
self.table[posy + y].setdefault(x, None)
return res
def process(self, products, ppg=PPG):
# Compute products positions on the grid
minpos = 0
index = 0
maxy = 0
x = 0
for p in products:
x = min(max(p.website_size_x, 1), PPR)
y = min(max(p.website_size_y, 1), PPR)
if index >= ppg:
x = y = 1
pos = minpos
while not self._check_place(pos % PPR, pos // PPR, x, y):
pos += 1
# if 21st products (index 20) and the last line is full (PPR products in it), break
# (pos + 1.0) / PPR is the line where the product would be inserted
# maxy is the number of existing lines
# + 1.0 is because pos begins at 0, thus pos 20 is actually the 21st block
# and to force python to not round the division operation
if index >= ppg and ((pos + 1.0) // PPR) > maxy:
break
if x == 1 and y == 1: # simple heuristic for CPU optimization
minpos = pos // PPR
for y2 in range(y):
for x2 in range(x):
self.table[(pos // PPR) + y2][(pos % PPR) + x2] = False
self.table[pos // PPR][pos % PPR] = {
'product': p, 'x': x, 'y': y,
'class': " ".join(x.html_class for x in p.website_style_ids if x.html_class)
}
if index <= ppg:
maxy = max(maxy, y + (pos // PPR))
index += 1
# Format table according to HTML needs
rows = sorted(self.table.items())
rows = [r[1] for r in rows]
for col in range(len(rows)):
cols = sorted(rows[col].items())
x += len(cols)
rows[col] = [r[1] for r in cols if r[1]]
return rows
class WebsiteLearning(http.Controller):
def _get_search_order(self, post):
# OrderBy will be parsed in orm and so no direct sql injection
# id is added to be sure that order is a unique sort key
return 'website_published desc,%s , id desc' % post.get('order', 'website_sequence desc')
def _get_compute_currency_and_context(self):
pricelist_context = dict(request.env.context)
pricelist = False
if not pricelist_context.get('pricelist'):
pricelist = request.website.get_current_pricelist()
pricelist_context['pricelist'] = pricelist.id
else:
pricelist = request.env['product.pricelist'].browse(pricelist_context['pricelist'])
from_currency = request.env.user.company_id.currency_id
to_currency = pricelist.currency_id
compute_currency = lambda price: from_currency.compute(price, to_currency)
return compute_currency, pricelist_context, pricelist
def _get_search_domain(self, search, category, attrib_values):
domain = [('is_training', '=', True)]
if search:
for srch in search.split(" "):
domain += [
'|', '|', '|', ('name', 'ilike', srch), ('description', 'ilike', srch),
('description_sale', 'ilike', srch), ('product_variant_ids.default_code', 'ilike', srch)]
if category:
domain += [('public_categ_ids', 'child_of', int(category))]
if attrib_values:
attrib = None
ids = []
for value in attrib_values:
if not attrib:
attrib = value[0]
ids.append(value[1])
elif value[0] == attrib:
ids.append(value[1])
else:
domain += [('attribute_line_ids.value_ids', 'in', ids)]
attrib = value[0]
ids = [value[1]]
if attrib:
domain += [('attribute_line_ids.value_ids', 'in', ids)]
return domain
@http.route([
'/learning',
'/learning/page/<int:page>',
'/learning/category/<model("product.public.category"):category>',
'/learning/category/<model("product.public.category"):category>/page/<int:page>'
], type='http', auth="public", website=True)
def learning(self, page=0, category=None, search='', **post):
ppg = 20
if category:
category = request.env['product.public.category'].search([('id', '=', int(category))], limit=1)
if not category:
raise NotFound()
attrib_list = request.httprequest.args.getlist('attrib')
attrib_values = [[int(x) for x in v.split("-")] for v in attrib_list if v]
attributes_ids = {v[0] for v in attrib_values}
attrib_set = {v[1] for v in attrib_values}
domain = self._get_search_domain(search, category, attrib_values)
keep = QueryURL('/learning', category=category and int(category), search=search, attrib=attrib_list, order=post.get('order'))
compute_currency, pricelist_context, pricelist = self._get_compute_currency_and_context()
request.context = dict(request.context, pricelist=pricelist.id, partner=request.env.user.partner_id)
url = "/learning"
if search:
post["search"] = search
if attrib_list:
post['attrib'] = attrib_list
categs = request.env['product.public.category'].search([('parent_id', '=', False)])
Product = request.env['product.template']
parent_category_ids = []
if category:
url = "/learning/category/%s" % slug(category)
parent_category_ids = [category.id]
current_category = category
while current_category.parent_id:
parent_category_ids.append(current_category.parent_id.id)
current_category = current_category.parent_id
product_count = Product.search_count(domain)
pager = request.website.pager(url=url, total=product_count, page=page, step=ppg, scope=7, url_args=post)
products = Product.search(domain, limit=ppg, offset=pager['offset'], order=self._get_search_order(post))
ProductAttribute = request.env['product.attribute']
if products:
# get all products without limit
selected_products = Product.search(domain, limit=False)
attributes = ProductAttribute.search([('attribute_line_ids.product_tmpl_id', 'in', selected_products.ids)])
else:
attributes = ProductAttribute.browse(attributes_ids)
values = {
'search': search,
'category': category,
'attrib_values': attrib_values,
'attrib_set': attrib_set,
'pager': pager,
'pricelist': pricelist,
'products': products,
'search_count': product_count, # common for all searchbox
'bins': TableCompute().process(products, ppg),
'rows': 5,
'categories': categs,
'attributes': attributes,
'compute_currency': compute_currency,
'keep': keep,
'parent_category_ids': parent_category_ids,
}
if category:
values['main_object'] = category
return request.render("training_base.learnings", values)
@http.route(['/learning/event'], type='http', auth="public", website=True)
def events(self, page=1, **searches):
Event = request.env['event.event']
EventType = request.env['event.type']
searches.setdefault('date', 'all')
searches.setdefault('type', 'all')
searches.setdefault('country', 'all')
searches.setdefault('product_id', 'all')
domain_search = {}
def sdn(date):
return fields.Datetime.to_string(date.replace(hour=23, minute=59, second=59))
def sd(date):
return fields.Datetime.to_string(date)
today = datetime.today()
dates = [
['all', _('Next Events'), [("date_end", ">", sd(today))], 0],
['today', _('Today'), [
("date_end", ">", sd(today)),
("date_begin", "<", sdn(today))],
0],
['week', _('This Week'), [
("date_end", ">=", sd(today + relativedelta(days=-today.weekday()))),
("date_begin", "<", sdn(today + relativedelta(days=6-today.weekday())))],
0],
['nextweek', _('Next Week'), [
("date_end", ">=", sd(today + relativedelta(days=7-today.weekday()))),
("date_begin", "<", sdn(today + relativedelta(days=13-today.weekday())))],
0],
['month', _('This month'), [
("date_end", ">=", sd(today.replace(day=1))),
("date_begin", "<", (today.replace(day=1) + relativedelta(months=1)).strftime('%Y-%m-%d 00:00:00'))],
0],
['nextmonth', _('Next month'), [
("date_end", ">=", sd(today.replace(day=1) + relativedelta(months=1))),
("date_begin", "<", (today.replace(day=1) + relativedelta(months=2)).strftime('%Y-%m-%d 00:00:00'))],
0],
['old', _('Old Events'), [
("date_end", "<", today.strftime('%Y-%m-%d 00:00:00'))],
0],
]
# search domains
# TDE note: WTF ???
current_date = None
current_type = None
current_country = None
for date in dates:
if searches["date"] == date[0]:
domain_search["date"] = date[2]
if date[0] != 'all':
current_date = date[1]
if searches["type"] != 'all':
current_type = EventType.browse(int(searches['type']))
domain_search["type"] = [("event_type_id", "=", int(searches["type"]))]
if searches["country"] != 'all' and searches["country"] != 'online':
current_country = request.env['res.country'].browse(int(searches['country']))
domain_search["country"] = ['|', ("country_id", "=", int(searches["country"])), ("country_id", "=", False)]
elif searches["country"] == 'online':
domain_search["country"] = [("country_id", "=", False)]
if searches["product_id"] != 'all':
domain_search["product_id"] = [("event_ticket_ids.product_id", "=", int(searches["product_id"]))]
def dom_without(without):
domain = [('state', "in", ['draft', 'confirm', 'done'])]
for key, search in domain_search.items():
if key != without:
domain += search
return domain
# count by domains without self search
for date in dates:
if date[0] != 'old':
date[3] = Event.search_count(dom_without('date') + date[2])
domain = dom_without('type')
types = Event.read_group(domain, ["id", "event_type_id"], groupby=["event_type_id"], orderby="event_type_id")
types.insert(0, {
'event_type_id_count': sum([int(type['event_type_id_count']) for type in types]),
'event_type_id': ("all", _("All Categories"))
})
domain = dom_without('country')
countries = Event.read_group(domain, ["id", "country_id"], groupby="country_id", orderby="country_id")
countries.insert(0, {
'country_id_count': sum([int(country['country_id_count']) for country in countries]),
'country_id': ("all", _("All Countries"))
})
step = 20 # Number of events per page
event_count = Event.search_count(dom_without("none"))
pager = request.website.pager(
url="/event",
url_args={'date': searches.get('date'), 'type': searches.get('type'), 'country': searches.get('country')},
total=event_count,
page=page,
step=step,
scope=5)
order = 'website_published desc, date_begin'
if searches.get('date', 'all') == 'old':
order = 'website_published desc, date_begin desc'
events = Event.search(dom_without("none"), limit=step, offset=pager['offset'], order=order)
values = {
'current_date': current_date,
'current_country': current_country,
'current_type': current_type,
'event_ids': events, # event_ids used in website_event_track so we keep name as it is
'dates': dates,
'types': types,
'countries': countries,
'pager': pager,
'searches': searches,
'search_path': "?%s" % werkzeug.url_encode(searches),
}
return request.render("website_event.index", values)

View File

@@ -1,368 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * learning_base
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-24 15:30+0000\n"
"PO-Revision-Date: 2020-04-24 17:36+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: fr\n"
"X-Generator: Poedit 2.0.4\n"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "All Categories"
msgstr "Toutes les catégories"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "All Countries"
msgstr "Tous les pays"
#. module: learning_base
#: model:ir.ui.menu,name:learning_base.ir_ui_menu_domaine_r0
msgid "Category"
msgstr "Catégorie"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__certificate
#: model:ir.model.fields,field_description:learning_base.field_product_template__certificate
msgid "Certificate"
msgstr "Certification"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__child_id
msgid "Child Domain"
msgstr "Domain enfant"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__code
msgid "Code"
msgstr "Code"
#. module: learning_base
#: model:ir.ui.menu,name:learning_base.ir_ui_menu_configuration_r0
msgid "Configuration"
msgstr "Configuration"
#. module: learning_base
#: model:ir.model,name:learning_base.model_res_partner
msgid "Contact"
msgstr "Contact"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__content
#: model:ir.model.fields,field_description:learning_base.field_product_template__content
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Content"
msgstr "Contenu"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__create_uid
msgid "Created by"
msgstr "Créé par"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__create_date
msgid "Created on"
msgstr "Créé le"
#. module: learning_base
#: model_terms:ir.actions.act_window,help:learning_base.ir_actions_act_window_formation_r0
msgid "Créer un nouveau article"
msgstr "Créer un nouveau article"
#. module: learning_base
#: model_terms:ir.actions.act_window,help:learning_base.ir_actions_act_window_session_r0
msgid "Créer un nouveau document"
msgstr "Créer un nouveau document"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__description
#: model:ir.model.fields,field_description:learning_base.field_product_template__description
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Description"
msgstr "Description"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__display_name
msgid "Display Name"
msgstr "Afficher Nom"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__domain_id
#: model:ir.model.fields,field_description:learning_base.field_product_template__domain_id
msgid "Domain"
msgstr "Domaine"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__parent_domain_id
#: model:ir.model.fields,field_description:learning_base.field_product_template__parent_domain_id
msgid "Domain parent"
msgstr "Domaine Parent"
#. module: learning_base
#: model:ir.actions.act_window,name:learning_base.ir_actions_act_window_domaine_r0
msgid "Domaine"
msgstr "Domaine"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_event_event__duration_hour
#: model:ir.model.fields,field_description:learning_base.field_product_product__duration_hour
#: model:ir.model.fields,field_description:learning_base.field_product_template__duration_hour
msgid "Duration in hour(s)"
msgstr "Durée en heure(s)"
#. module: learning_base
#: model:ir.model,name:learning_base.model_event_event
msgid "Event"
msgstr "Événement"
#. module: learning_base
#: model:ir.model,name:learning_base.model_event_registration
msgid "Event Registration"
msgstr "Inscription à l'événement"
#. module: learning_base
#: model:ir.actions.act_window,name:learning_base.ir_actions_act_window_formation_r0
#: model:ir.module.category,name:learning_base.ir_module_category_formation_r0
msgid "Formation"
msgstr "Formation"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__goal
#: model:ir.model.fields,field_description:learning_base.field_product_template__goal
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Goal"
msgstr "Objectif(s)"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__id
msgid "ID"
msgstr "ID"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_res_partner__is_student
#: model:ir.model.fields,field_description:learning_base.field_res_users__is_student
msgid "Is student ?"
msgstr "Etudiant"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_res_partner__is_trainer
#: model:ir.model.fields,field_description:learning_base.field_res_users__is_trainer
msgid "Is trainer ?"
msgstr "Formateur"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_event_event__learning_id
#: model:ir.ui.menu,name:learning_base.ir_ui_menu_formation_r0
#: model:ir.ui.menu,name:learning_base.ir_ui_menu_formation_r1
#: model:ir.ui.menu,name:learning_base.ir_ui_menu_inscriptions_r0
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Learning"
msgstr "Formation"
#. module: learning_base
#: model:res.groups,name:learning_base.group_learning_administration
msgid "Learning Administrator"
msgstr "Administrateur des formations"
#. module: learning_base
#: model:res.groups,name:learning_base.group_learning_backoffice
msgid "Learning Backoffice"
msgstr "Utilisateur des formations"
#. module: learning_base
#: model:ir.module.category,name:learning_base.module_category_learning
msgid "Learning Management"
msgstr "Gestion des formations"
#. module: learning_base
#: model:res.groups,name:learning_base.group_learning_student
msgid "Learning Student"
msgstr "Apprenant"
#. module: learning_base
#: model:res.groups,name:learning_base.group_learning_teacher
msgid "Learning Teacher"
msgstr "Formateur"
#. module: learning_base
#: model:res.groups,name:learning_base.group_learning_trainer
msgid "Learning Trainer"
msgstr "Formateur"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__methodology
#: model:ir.model.fields,field_description:learning_base.field_product_template__methodology
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Methodology"
msgstr "Méthodologie"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__name
msgid "Name"
msgstr "Nom"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__count_session
#: model:ir.model.fields,field_description:learning_base.field_product_template__count_session
msgid "Nb session"
msgstr "Nb Session(s)"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "Next Events"
msgstr "Prochains événements"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "Next Week"
msgstr "Semaine suivante"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "Next month"
msgstr "Mois suivant"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "Old Events"
msgstr "Anciens événements"
#. module: learning_base
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Our value"
msgstr "Nos « plus »"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__parent_id
msgid "Parent Domain"
msgstr "Domaine parent"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_learning_domain__parent_path
msgid "Parent Path"
msgstr "Chemin parent"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "Past Events"
msgstr "Événements passés"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__prerequisite
#: model:ir.model.fields,field_description:learning_base.field_product_template__prerequisite
msgid "Prerequisite"
msgstr "Les Pré-requis"
#. module: learning_base
#: model:ir.model,name:learning_base.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__public
#: model:ir.model.fields,field_description:learning_base.field_product_template__public
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Public"
msgstr "Publique"
#. module: learning_base
#: model:ir.actions.act_window,name:learning_base.ir_actions_act_window_session_r0
#: model:ir.ui.menu,name:learning_base.ir_ui_menu_session_r0
msgid "Session"
msgstr "Session"
#. module: learning_base
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Sessions"
msgstr "Sessions"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "This Week"
msgstr "Cette semaine"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "This month"
msgstr "Ce mois"
#. module: learning_base
#: code:addons/learning_base/controler/main.py:0
#, python-format
msgid "Today"
msgstr "Aujourd'hui"
#. module: learning_base
#: model:res.groups,name:learning_base.res_groups_utilisateur_r0
msgid "Utilisateur"
msgstr "Utilisateur"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__validate
#: model:ir.model.fields,field_description:learning_base.field_product_template__validate
msgid "Validate"
msgstr "Valider"
#. module: learning_base
#: model_terms:ir.ui.view,arch_db:learning_base.learning_base_product_template_form
msgid "Validation"
msgstr "Validation"
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_product_product__our_value
#: model:ir.model.fields,field_description:learning_base.field_product_template__our_value
msgid "Value"
msgstr "Valeur"
#. module: learning_base
#: code:addons/learning_base/models/learning_domain.py:0
#, python-format
msgid "You cannot create recursive domain."
msgstr "Impossible de créer un domaine récursif."
#. module: learning_base
#: model:ir.model.fields,field_description:learning_base.field_event_registration__is_learning
#: model:ir.model.fields,field_description:learning_base.field_product_product__is_learning
#: model:ir.model.fields,field_description:learning_base.field_product_template__is_learning
msgid "is learning"
msgstr "Est une formation"
#. module: learning_base
#: model:ir.model,name:learning_base.model_learning_domain
msgid "learning.domain"
msgstr "learning.domain"

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="ir_actions_act_window_formation_r0" model="ir.actions.act_window">
<field name="domain">[('detailed_type', '=', 'learning')]</field>
<field name="context">{'default_detailed_type': 'learning'}</field>
<field name="help">&lt;p class="o_view_nocontent_smiling_face"&gt;Créer un nouveau article&lt;/p&gt;</field>
<field name="res_model">product.template</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,tree,form,activity</field>
<!-- one2many field 'view_ids' managed on the ir.actions.act_window.view side -->
<field name="name">Formation</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False"/>
<field name="limit">80</field>
</record>
<record id="ir_actions_act_window_session_r0" model="ir.actions.act_window">
<field name="help">&lt;p class="o_view_nocontent_smiling_face"&gt;Créer un nouveau document&lt;/p&gt;</field>
<field name="res_model">event.event</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,calendar,tree,form,pivot</field>
<!-- one2many field 'view_ids' managed on the ir.actions.act_window.view side -->
<field name="name">Session</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False"/>
<field name="limit">80</field>
<field name="context">{"search_default_upcoming":1, "search_default_learning_filter": 1}</field>
</record>
<record id="ir_actions_act_window_domaine_r0" model="ir.actions.act_window">
<field name="res_model">learning.domain</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<!-- one2many field 'view_ids' managed on the ir.actions.act_window.view side -->
<field name="name">Domaine</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False"/>
<field name="limit">80</field>
</record>
<record id="ir_actions_act_window_learning_company_r0" model="ir.actions.act_window">
<field name="domain">[('is_company', '=', 1), ('is_learning_contact', '=', 1)]</field>
<field name="context">{'search_default_supplier': 1,'res_partner_search_mode': 'supplier','default_is_learning_contact': True,'default_is_company': True}</field>
<field name="help">&lt;p class="o_view_nocontent_smiling_face"&gt;Créer un nouveau Partenaire de formation&lt;/p&gt;</field>
<field name="res_model">res.partner</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,tree,form,activity</field>
<!-- one2many field 'view_ids' managed on the ir.actions.act_window.view side -->
<field name="name">Learning Company</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False"/>
<field name="limit">80</field>
</record>
<record id="ir_actions_act_window_trainer_r0" model="ir.actions.act_window">
<field name="domain">[('is_company', '=', 0), ('is_trainer', '=', 1)]</field>
<field name="context">{'search_default_supplier': 1,'res_partner_search_mode': 'supplier','default_is_learning_contact': True,'default_is_trainer': True,'default_is_company': False}</field>
<field name="help">&lt;p class="o_view_nocontent_smiling_face"&gt;Créer un nouveau Formateur&lt;/p&gt;</field>
<field name="res_model">res.partner</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,tree,form,activity</field>
<!-- one2many field 'view_ids' managed on the ir.actions.act_window.view side -->
<field name="name">Trainer(s)</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False"/>
<field name="limit">80</field>
</record>
</data>
</openerp>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem id="ir_ui_menu_inscriptions_r0" name="Learning" sequence="10" groups="group_learning_trainer"/>
<menuitem id="ir_ui_menu_formation_r0" name="Learning" parent="ir_ui_menu_inscriptions_r0" sequence="10"/>
<menuitem id="ir_ui_menu_formation_r1" name="Learning" parent="ir_ui_menu_formation_r0" sequence="10" action="ir_actions_act_window_formation_r0"/>
<menuitem id="ir_ui_menu_session_r0" name="Session" parent="ir_ui_menu_formation_r0" sequence="10" action="ir_actions_act_window_session_r0"/>
<menuitem id="ir_ui_menu_contact_r0" parent="ir_ui_menu_inscriptions_r0" name="Contact" sequence="20"/>
<menuitem id="ir_ui_menu_contact_r1" name="Learning Company" parent="ir_ui_menu_contact_r0" sequence="10" action="ir_actions_act_window_learning_company_r0"/>
<menuitem id="ir_ui_menu_contact_r2" name="Trainer(s)" parent="ir_ui_menu_contact_r0" sequence="20" action="ir_actions_act_window_trainer_r0"/>
<menuitem id="ir_ui_menu_configuration_r0" name="Configuration" parent="ir_ui_menu_inscriptions_r0" sequence="99" groups="group_learning_administration"/>
<menuitem id="ir_ui_menu_domaine_r0" parent="ir_ui_menu_configuration_r0" name="Category" sequence="10" action="ir_actions_act_window_domaine_r0"/>
</data>
</openerp>

View File

@@ -1,6 +0,0 @@
from . import product_template
from . import event_event
from . import res_partner
from . import learning_domain
from . import res_company
from . import website

View File

@@ -1,39 +0,0 @@
# Copyright 2018 Nicolas JEUDY
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
import datetime
from odoo import api, fields, models, _
_logger = logging.getLogger(__name__)
class EventEvent(models.Model):
_inherit = ['event.event']
duration_hour = fields.Float('Duration in hour(s)')
learning_id = fields.Many2one('product.template', string='Learning', domain=[('is_learning', '=', True)])
date_text= fields.Char("Date in text mode")
hour_text= fields.Char("Training time")
duration_days = fields.Float(related='learning_id.duration_days', store=True )
methodology_partner_id = fields.Many2one('res.partner', "Methodology partner")
class EventRegistration(models.Model):
_inherit = 'event.registration'
is_learning = fields.Boolean(related='event_id.learning_id.is_learning', readonly="1", store=True)
class EventTicket(models.Model):
_inherit = 'event.event.ticket'
@api.model
def default_get(self, fields):
res = super(EventTicket, self).default_get(fields)
product_tmpl_id = self.env.context.get('learning_id', False)
if product_tmpl_id:
product_id = self.env['product.product'].search(
[('product_tmpl_id', '=', product_tmpl_id)],
limit=1
)
if product_id:
res['product_id'] = product_id.id
return res

View File

@@ -1,20 +0,0 @@
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class LearningDomain(models.Model):
_name = 'learning.domain'
_parent_name = "parent_id"
_parent_store = True
name = fields.Char('Name')
code = fields.Char('Code', translate=False)
parent_id = fields.Many2one('learning.domain', 'Parent Domain', index=True, ondelete='cascade')
parent_path = fields.Char(index=True)
child_id = fields.One2many('learning.domain', 'parent_id', 'Child Domain')
@api.constrains('parent_id')
def _check_domain_recursion(self):
if not self._check_recursion():
raise ValidationError(_('You cannot create recursive domain.'))
return True

View File

@@ -1,58 +0,0 @@
# Copyright 2018 Nicolas JEUDY
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
class learningFinancialProgram(models.Model):
_name = 'learning.financial.program'
_description = "Learning Financial Program"
product_tmpl_ids = fields.Many2many('product.template', 'financial_program_product_category_rel', 'financial_program_id', 'product_category_id', 'Products')
name = fields.Char("Name")
description = fields.Text('Description')
description_html = fields.Html("Web Description")
class ProductTemplate(models.Model):
_inherit = ['product.template']
is_learning = fields.Boolean(string='is learning')
goal = fields.Html(string='Goal', translate=True)
duration_html = fields.Html(string='Duration', translate=True)
public = fields.Html(string='Public', translate=True)
prerequisite = fields.Html(string='Prerequisite', translate=True)
content = fields.Html(string='Content', translate=True)
organizer = fields.Html(string='Organizer', translate=True)
methodology = fields.Html(string='Methodology', translate=True)
technic = fields.Html(string='Technical', translate=True)
price_html = fields.Html(string='Price', translate=True)
registration = fields.Html(string='Registration', translate=True)
our_value = fields.Html(string='Value', translate=True)
description = fields.Html(string='Description', translate=True)
validate = fields.Html(string='Validate', translate=True)
certificate = fields.Html(string='Certificate', translate=True)
financial_program_ids = fields.Many2many('learning.financial.program', 'financial_program_product_category_rel', 'product_category_id', 'financial_program_id', 'Financial Program')
parent_domain_id = fields.Many2one('learning.domain', related='domain_id.parent_id', store=True, string="Domain parent")
domain_id = fields.Many2one('learning.domain', string="Domain")
duration_hour = fields.Float('Duration in hour(s)')
hours_per_day = fields.Float('Nb hour(s) per day(s) ?')
duration_days = fields.Float('Duration in day(s)')
duration_text = fields.Text('Duration details')
count_session = fields.Integer('Nb session', compute="_compute_session", readonly=True)
sessions_ids = fields.One2many('event.event', 'learning_id', 'Slots')
# ajouter la nature de l'action de formation avec la liste
def _compute_session(self):
for record in self:
record.count_session = len(self.env['event.event'].search([('learning_id', '=', record.id)]))
def _detailed_type_mapping(self):
type_mapping = super()._detailed_type_mapping()
type_mapping['learning'] = 'service'
return type_mapping

View File

@@ -1,10 +0,0 @@
# Copyright 2018 Nicolas JEUDY
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
class ResCompany(models.Model):
_inherit = 'res.company'
learning_code = fields.Char('Learning Code')
learning_support_email = fields.Char("Support Email")

View File

@@ -1,36 +0,0 @@
# Copyright 2018 Nicolas JEUDY
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
#import barcode
#from barcode.writer import ImageWriter
import base64
import logging
from io import BytesIO
import re
import unicodedata
from odoo import api, fields, models, _
class ResPartner(models.Model):
_inherit = 'res.partner'
# student_barcode = fields.Binary('Barcode', attachment=True, compute="_compute_barcode", store=True)
is_student = fields.Boolean("Student")
is_trainer = fields.Boolean("Trainer")
is_learning_contact = fields.Boolean("Learning contact")
trainer_cv = fields.Char("CV")
# ajouter un lien vers linkedin ou site internet
#@api.depends('ref')
#def _compute_barcode(self):
# for record in self:
# if record.ref:
# CODE39 = barcode.get_barcode_class('code39')
# code39 = CODE39(record.ref, writer=ImageWriter(), add_checksum=False)
# fp = BytesIO()
# code39.write(fp)
# #barcode.generate('code39', self.ref, writer=ImageWriter(), output=fp)
# record.student_barcode = base64.b64encode(fp.getvalue())
# else:
# record.student_barcode = False

View File

@@ -1,14 +0,0 @@
import logging
from odoo import models
_logger = logging.getLogger(__name__)
class Website(models.Model):
_inherit = 'website'
def sale_product_domain(self):
# ['&', ('sale_ok', '=', True), ('website_id', 'in', (False, 1)), ('event_ok', '=', False)]
_logger.debug(super(Website, self).sale_product_domain())
#return ['&'] + super(Website, self).sale_product_domain() + [('event_ok', '=', False)]
return [('sale_ok', '=', True), ('website_id', 'in', (False, 1))]

View File

@@ -1,16 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_move_manager,learning: account_move manager,account.model_account_move,learning_base.group_learning_administration,1,0,0,0
access_sale_order_manager,learning: sale.order.manager,sale.model_sale_order,learning_base.group_learning_administration,1,1,1,1
access_sale_report_manager,learning: sale.report,sale.model_sale_report,learning_base.group_learning_administration,1,1,1,1
access_product_supplierinfo_sale_manager,learning: product.supplierinfo salemanager,product.model_product_supplierinfo,learning_base.group_learning_administration,1,1,1,1
access_product_group_res_partner_sale_manager,learning: res_partner group_sale_manager,base.model_res_partner,learning_base.group_learning_administration,1,1,1,0
access_product_template_sale_manager,learning: product.template salemanager,product.model_product_template,learning_base.group_learning_administration,1,1,1,1
access_product_product_sale_manager,learning: product.product salemanager,product.model_product_product,learning_base.group_learning_administration,1,1,1,1
access_product_attribute_sale_manager,learning: product.attribute manager,product.model_product_attribute,learning_base.group_learning_administration,1,1,1,1
access_product_attribute_value_sale_manager,learning: product.attribute manager value,product.model_product_attribute_value,learning_base.group_learning_administration,1,1,1,1
access_product_product_attribute_sale_manager,learning: product.template.attribute manager value,product.model_product_template_attribute_value,learning_base.group_learning_administration,1,1,1,1
access_product_template_attribute_exclusion_sale_manager,learning: product.attribute manager filter line,product.model_product_template_attribute_exclusion,learning_base.group_learning_administration,1,1,1,1
access_product_template_attribute_line_sale_manager,learning: product.attribute manager line,product.model_product_template_attribute_line,learning_base.group_learning_administration,1,1,1,1
access_account_account_sale_manager,learning: account.account sale manager,account.model_account_account,learning_base.group_learning_administration,1,0,0,0
access_mail_activity_type_sale_manager,learning: mail.activity.type.sale.manager,mail.model_mail_activity_type,learning_base.group_learning_administration,1,1,1,1
access_report_all_channels_sales,learning: access_report_all_channels_sales,sale.model_sale_report,learning_base.group_learning_administration,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_move_manager learning: account_move manager account.model_account_move learning_base.group_learning_administration 1 0 0 0
3 access_sale_order_manager learning: sale.order.manager sale.model_sale_order learning_base.group_learning_administration 1 1 1 1
4 access_sale_report_manager learning: sale.report sale.model_sale_report learning_base.group_learning_administration 1 1 1 1
5 access_product_supplierinfo_sale_manager learning: product.supplierinfo salemanager product.model_product_supplierinfo learning_base.group_learning_administration 1 1 1 1
6 access_product_group_res_partner_sale_manager learning: res_partner group_sale_manager base.model_res_partner learning_base.group_learning_administration 1 1 1 0
7 access_product_template_sale_manager learning: product.template salemanager product.model_product_template learning_base.group_learning_administration 1 1 1 1
8 access_product_product_sale_manager learning: product.product salemanager product.model_product_product learning_base.group_learning_administration 1 1 1 1
9 access_product_attribute_sale_manager learning: product.attribute manager product.model_product_attribute learning_base.group_learning_administration 1 1 1 1
10 access_product_attribute_value_sale_manager learning: product.attribute manager value product.model_product_attribute_value learning_base.group_learning_administration 1 1 1 1
11 access_product_product_attribute_sale_manager learning: product.template.attribute manager value product.model_product_template_attribute_value learning_base.group_learning_administration 1 1 1 1
12 access_product_template_attribute_exclusion_sale_manager learning: product.attribute manager filter line product.model_product_template_attribute_exclusion learning_base.group_learning_administration 1 1 1 1
13 access_product_template_attribute_line_sale_manager learning: product.attribute manager line product.model_product_template_attribute_line learning_base.group_learning_administration 1 1 1 1
14 access_account_account_sale_manager learning: account.account sale manager account.model_account_account learning_base.group_learning_administration 1 0 0 0
15 access_mail_activity_type_sale_manager learning: mail.activity.type.sale.manager mail.model_mail_activity_type learning_base.group_learning_administration 1 1 1 1
16 access_report_all_channels_sales learning: access_report_all_channels_sales sale.model_sale_report learning_base.group_learning_administration 1 0 0 0

View File

@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<odoo>
<data noupdate="0">
<record id="module_category_learning" model="ir.module.category">
<field name="name">Learning Management</field>
<field name="sequence">22</field>
</record>
<record id="group_learning_backoffice" model="res.groups">
<field name="name">Learning Backoffice</field>
<field name="category_id" ref="module_category_learning"/>
</record>
<record id="group_learning_trainer" model="res.groups">
<field name="name">Learning Trainer</field>
<field name="implied_ids" eval="[(4, ref('group_learning_backoffice')), (4, ref('sales_team.group_sale_salesman_all_leads'))]"/>
<field name="category_id" ref="module_category_learning"/>
</record>
<record id="group_learning_student" model="res.groups">
<field name="name">Learning Student</field>
<field name="category_id" ref="module_category_learning"/>
</record>
<record id="res_groups_utilisateur_r0" model="res.groups">
<field name="name">Utilisateur</field>
<field name="category_id" ref="module_category_learning"/>
</record>
<record id="group_learning_administration" model="res.groups">
<field name="name">Learning Administrator</field>
<field name="category_id" ref="module_category_learning"/>
<field name="implied_ids" eval="[(4, ref('res_groups_utilisateur_r0')), (4, ref('group_learning_backoffice')), (4, ref('website.group_website_designer'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<!-- ir.rules -->
<record id="learning_product_rule_portal" model="ir.rule">
<field name="name">Learning Product Rules</field>
<field name="model_id" ref="product.model_product_template"/>
<field name="domain_force">[('is_learning','=',1)]</field>
<field name="groups" eval="[(4, ref('learning_base.group_learning_trainer'))]"/>
<field name="perm_unlink" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_read" eval="True"/>
<field name="perm_create" eval="True"/>
</record>
</data>
</odoo>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Nicolas JEUDY
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="learning_base_event_event_form" model="ir.ui.view">
<field name="name">event.event.learning.form.inherit</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<data>
<field name="date_tz" position="after">
<field name="duration_hour" widget="float_time"/>
<field name="duration_days" readonly="1"/>
<field name="date_text"/>
<field name="hour_text"/>
</field>
<field name="organizer_id" position="before">
<field name="learning_id"/>
</field>
<field name="organizer_id" position="after">
<field name="methodology_partner_id"/>
</field>
<field name="event_ticket_ids" position="attributes">
<attribute name="context">{'default_name': name, 'learning_id': learning_id}</attribute>
</field>
</data>
</field>
</record>
<record id="learning_base_view_event_search" model="ir.ui.view">
<field name="name">learning.base.event_search.inherit</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_search"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="learning_id"/>
</field>
</field>
</record>
</odoo>

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Nicolas JEUDY
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="learning_base_product_template_form" model="ir.ui.view">
<field name="name">product.template.learning.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button name="%(ir_actions_act_window_session_r0)d"
type="action"
class="oe_stat_button"
icon="fa-pencil-square-o"
context="{'search_default_learning_id': active_id, 'default_name': name, 'default_learning_id': active_id}">
<field name="count_session" widget="statinfo" string="Sessions" />
</button>
</div>
<field name="detailed_type" position="after">
<field name="is_learning" />
</field>
<page name="sales" position="after">
<page string="Learning" attrs="{'invisible':[('is_learning','=', False)]}"
name="Learning">
<group name="Informations">
<group>
<field name="domain_id" />
</group>
</group>
<group name="Duration">
<group>
<field name="duration_days" />
<field name="hours_per_day" />
<field name="duration_hour" />
</group>
<group>
<field name="duration_text" placeholder="Specific duration details" nolabel="1" />
</group>
</group>
<group name="Financial Programs">
<field name="financial_program_ids" widget="many2many_tags" />
</group>
<div name="learning_data">
<separator string="Goal" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="goal" readonly="1" />
<separator string="Duration Details" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="duration_html" readonly="1" />
<separator string="Public" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="public" readonly="1" />
<separator string="Prerequisite" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="prerequisite" readonly="1" />
<separator string="Content" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="content" readonly="1" />
<separator string="Organizer" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="organizer" readonly="1" />
<separator string="Methodology" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="methodology" readonly="1" />
<separator string="Technical" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="technic" readonly="1" />
<separator string="Price details" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="price_html" readonly="1" />
<separator string="Registration" />
<div class="alert alert-info" role="alert">
To edit content, please go to the website page directly.
</div>
<field name="registration" readonly="1" />
</div>
</page>
</page>
</field>
</record>
</odoo>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Nicolas JEUDY
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="learning_base_view_company_form" model="ir.ui.view">
<field name="name">learning_base.view_company_form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<data>
<notebook position="inside">
<page name="learning" string="Learning">
<group name="legal" string="Legal">
<field name="learning_code"/>
<field name="learning_support_email"/>
</group>
</page>
</notebook>
</data>
</field>
</record>
</odoo>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Nicolas JEUDY
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="learning_base_view_partner_form" model="ir.ui.view">
<field name="name">learning.base.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page name="learning" string="Learning Info">
<group>
<field name="is_trainer"/>
<field name="is_student"/>
<field name="is_learning_contact"/>
</group>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="learning_product" inherit_id="website_sale.product" active="True" name="Learning Product">
<xpath expr="//div[@id='product_full_description']" position="before">
<section t-if="product.is_learning" id="learning_detail" class="container">
<h2>Goal</h2>
<div itemprop="goal" t-field="product.goal" class="oe_structure mt16" id="product_goal"/>
</section>
<section t-if="product.is_learning" id="learning_detail" class="container">
<h2>Duration Details</h2>
<div itemprop="duration_html" t-field="product.duration_html" class="oe_structure mt16" id="product_duration_html"/>
</section>
<section t-if="product.is_learning" id="learning_public" class="container">
<h2>Public</h2>
<div itemprop="public" t-field="product.public" class="oe_structure mt16" id="product_public"/>
</section>
<section t-if="product.is_learning" id="learning_prerequisite" class="container">
<h2>Prerequisite</h2>
<div itemprop="prerequisite" t-field="product.prerequisite" class="oe_structure mt16" id="product_prerequisite"/>
</section>
<section t-if="product.is_learning" id="learning_content" class="container">
<h2>Content</h2>
<div itemprop="content" t-field="product.content" class="oe_structure mt16" id="product_content"/>
</section>
<section t-if="product.is_learning" id="learning_organizer" class="container">
<h2>Organizer</h2>
<div itemprop="organizer" t-field="product.organizer" class="oe_structure mt16" id="product_organizer"/>
</section>
<section t-if="product.is_learning" id="learning_methodology" class="container">
<h2>Methodology</h2>
<div itemprop="methodology" t-field="product.methodology" class="oe_structure mt16" id="product_methodology"/>
</section>
<section t-if="product.is_learning" id="learning_technic" class="container">
<h2>Technic</h2>
<div itemprop="technic" t-field="product.technic" class="oe_structure mt16" id="product_technic"/>
</section>
<section t-if="product.is_learning" id="learning_technic" class="container">
<h2>Price Details</h2>
<div t-field="product.price_html" class="oe_structure mt16" id="product_price_html"/>
</section>
<section t-if="product.is_learning" id="learning_technic" class="container">
<h2>Registration Details</h2>
<div t-field="product.registration" class="oe_structure mt16" id="product_registration"/>
</section>
</xpath>
</template>
</odoo>

View File

@@ -1,91 +0,0 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
======================
Learning Event Partner
======================
In learning session you may have many speaker / teacher. This module add the management for this case.
Installation
============
To install this module, you need to:
#. Do this ...
Configuration
=============
To configure this module, you need to:
#. Go to ...
.. figure:: path/to/local/image.png
:alt: alternative description
:width: 600 px
Usage
=====
To use this module, you need to:
#. Go to ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch}
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
Known issues / Roadmap
======================
* ...
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Firstname Lastname <email.address@example.org>
* Second Person <second.person@example.org>
Funders
-------
The development of this module has been financially supported by:
* Company 1 name
* Company 2 name
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
{
"name": "Learning Event Partner",
"version": "16.0.0.0.0",
"depends": [
#'__export__',
"base",
"event",
"hr",
],
"author": "Nicolas JEUDY",
"installable": True,
"data": [
"views/event_menu_view.xml",
"views/event_speakers_view.xml",
"views/event_event_view.xml",
"views/hr_employee_views.xml",
"security/ir.model.access.csv",
],
}

View File

@@ -1,465 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * learning_event_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-29 18:16+0000\n"
"PO-Revision-Date: 2021-11-29 19:23+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: fr\n"
"X-Generator: Poedit 3.0\n"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_needaction
msgid "Action Needed"
msgstr "Action necessaire"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_ids
msgid "Activities"
msgstr "Activités"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_exception_decoration
msgid "Activity Exception Decoration"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_state
msgid "Activity State"
msgstr "Status de l'activité"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_type_icon
msgid "Activity Type Icon"
msgstr "Icon Type d'activité"
#. module: learning_event_partner
#: model_terms:ir.actions.act_window,help:learning_event_partner.act_speakers_from_event
msgid "Add new speakers to this event"
msgstr "Ajouter un nouvel intervenant pour cet évènement"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_attachment_count
msgid "Attachment Count"
msgstr "Pièce jointes"
#. module: learning_event_partner
#: code:addons/learning_event_partner/models/event_speaker_stage.py:0
#, python-format
msgid "Blocked"
msgstr "Blocké"
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_kanban
msgid "By"
msgstr "Par"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__create_uid
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__create_uid
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__create_uid
msgid "Created by"
msgstr "Créé par"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__create_date
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__create_date
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__create_date
msgid "Created on"
msgstr "Créé le"
#. module: learning_event_partner
#: model:ir.model,name:learning_event_partner.model_event_discipline
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__discipline_id
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Discipline"
msgstr "Discipline"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__display_name
#: model:ir.model.fields,field_description:learning_event_partner.field_event_event__display_name
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__display_name
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Employee"
msgstr "Employé"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__pipe_end
msgid "End Stage"
msgstr "Stage final"
#. module: learning_event_partner
#: model:ir.model,name:learning_event_partner.model_event_event
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__event_id
msgid "Event"
msgstr "Événement"
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker_stage__pipe_end
msgid ""
"Events will automatically be moved into this stage when they are finished. "
"The event moved into this stage will automatically be set as green."
msgstr ""
"L'intervenant passera automatiquement à ce status quant le traitement sera "
"terminé."
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__extra_price
msgid "Extra Price"
msgstr "Montant Supplément"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__fold
msgid "Folded in Kanban"
msgstr "Replié en vue Kanban"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_follower_ids
msgid "Followers"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_channel_ids
msgid "Followers (Channels)"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_partner_ids
msgid "Followers (Partners)"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__activity_type_icon
msgid "Font awesome icon e.g. fa-tasks"
msgstr ""
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Future Activities"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__legend_done
msgid "Green Kanban Label"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__legend_normal
msgid "Grey Kanban Label"
msgstr ""
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Group By"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__has_extra
msgid "Has Extra ?"
msgstr "Souhait un supplément ?"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__id
#: model:ir.model.fields,field_description:learning_event_partner.field_event_event__id
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__id
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__id
msgid "ID"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_exception_icon
msgid "Icon"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__activity_exception_icon
msgid "Icon to indicate an exception activity."
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__message_needaction
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__message_unread
msgid "If checked, new messages require your attention."
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__message_has_error
msgid "If checked, some messages have a delivery error."
msgstr ""
#. module: learning_event_partner
#: code:addons/learning_event_partner/models/event_speaker_stage.py:0
#, python-format
msgid "In Progress"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_is_follower
msgid "Is Follower"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline____last_update
#: model:ir.model.fields,field_description:learning_event_partner.field_event_event____last_update
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker____last_update
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__write_uid
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__write_uid
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__write_uid
msgid "Last Updated by"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__write_date
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__write_date
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__write_date
msgid "Last Updated on"
msgstr ""
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Late Activities"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_main_attachment_id
msgid "Main Attachment"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_has_error
msgid "Message Delivery error"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_ids
msgid "Messages"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__my_activity_date_deadline
msgid "My Activity Deadline"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_discipline__name
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__name
msgid "Name"
msgstr "Nom"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_date_deadline
msgid "Next Activity Deadline"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_summary
msgid "Next Activity Summary"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_type_id
msgid "Next Activity Type"
msgstr ""
#. module: learning_event_partner
#: model_terms:ir.actions.act_window,help:learning_event_partner.act_speakers_from_event
msgid "No Speakers Yet !"
msgstr "Aucun intervenant pour le moment !"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_needaction_counter
msgid "Number of Actions"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_has_error_counter
msgid "Number of errors"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__message_needaction_counter
msgid "Number of messages which requires an action"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__message_has_error_counter
msgid "Number of messages with delivery error"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_event__nb_speakers
msgid "Number of speaker"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__message_unread_counter
msgid "Number of unread messages"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker_stage__legend_blocked
msgid ""
"Override the default value displayed for the blocked state for kanban "
"selection."
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker_stage__legend_done
msgid ""
"Override the default value displayed for the done state for kanban "
"selection."
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker_stage__legend_normal
msgid ""
"Override the default value displayed for the normal state for kanban "
"selection."
msgstr ""
#. module: learning_event_partner
#: code:addons/learning_event_partner/models/event_speaker_stage.py:0
#, python-format
msgid "Ready for Next Stage"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__legend_blocked
msgid "Red Kanban Label"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__activity_user_id
msgid "Responsible User"
msgstr ""
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Search Speakers"
msgstr "Rechercher dans les intervenants"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__sequence
msgid "Sequence"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__employee_id
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_form
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Speaker"
msgstr "Intervenant"
#. module: learning_event_partner
#: model:ir.actions.act_window,name:learning_event_partner.action_event_discipline
#: model:ir.ui.menu,name:learning_event_partner.menu_event_discipline
msgid "Speaker Discipline"
msgstr "Discipline de l'intervanant"
#. module: learning_event_partner
#: model:ir.actions.act_window,name:learning_event_partner.action_event_speaker_stage
#: model:ir.model,name:learning_event_partner.model_event_speaker_stage
msgid "Speaker Stage"
msgstr "Status de l'intervenant"
#. module: learning_event_partner
#: model:ir.ui.menu,name:learning_event_partner.event_speaker_stage_menu
msgid "Speaker Stages"
msgstr "Status des intervenants"
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.view_event_form_inherit_learning_event_partner
msgid "Speaker for this event"
msgstr "Intervenant pour cet évènement."
#. module: learning_event_partner
#: model:ir.actions.act_window,name:learning_event_partner.act_speakers_from_event
#: model:ir.model.fields,field_description:learning_event_partner.field_event_event__speaker_ids
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_tree
#: model_terms:ir.ui.view,arch_db:learning_event_partner.view_event_form_inherit_learning_event_partner
msgid "Speakers"
msgstr "Intervenants"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__stage_id
msgid "Stage"
msgstr "Status"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__name
msgid "Stage Name"
msgstr "Nom du status"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker_stage__description
msgid "Stage description"
msgstr "Description du status"
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__standard_price
msgid "Standard Price"
msgstr "Prix"
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__activity_state
msgid ""
"Status based on activities\n"
"Overdue: Due date is already passed\n"
"Today: Activity date is today\n"
"Planned: Future activities."
msgstr ""
#. module: learning_event_partner
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Today Activities"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__activity_exception_decoration
msgid "Type of the exception activity on record."
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_unread
#: model_terms:ir.ui.view,arch_db:learning_event_partner.event_speaker_view_search
msgid "Unread Messages"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__message_unread_counter
msgid "Unread Messages Counter"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,field_description:learning_event_partner.field_event_speaker__website_message_ids
msgid "Website Messages"
msgstr ""
#. module: learning_event_partner
#: model:ir.model.fields,help:learning_event_partner.field_event_speaker__website_message_ids
msgid "Website communication history"
msgstr ""
#. module: learning_event_partner
#: model:ir.model,name:learning_event_partner.model_event_speaker
msgid "event.speaker"
msgstr "event.speaker"

View File

@@ -1,3 +0,0 @@
from . import event_event
from . import event_speaker
from . import event_speaker_stage

View File

@@ -1,33 +0,0 @@
# Copyright 2018 Nicolas JEUDY
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from odoo import api, fields, models, _
_logger = logging.getLogger(__name__)
class EventEvent(models.Model):
_inherit = ["event.event"]
speaker_ids = fields.One2many("event.speaker", "event_id", string="Speakers")
nb_speakers = fields.Integer(
string="Number of speaker", readonly=True, compute="_compute_nb_speakers"
)
@api.depends("speaker_ids")
def _compute_nb_speakers(self):
for event in self:
event.nb_speakers = len(event.speaker_ids)
class EventDiscipline(models.Model):
_name = "event.discipline"
_description = "Discipline"
name = fields.Char("Name")
class EmployeeDiscipline(models.Model):
_inherit = "hr.employee"
discipline_ids = fields.Many2many("event.discipline", string="Disciplines")

View File

@@ -1,52 +0,0 @@
# Copyright 2018 Nicolas JEUDY
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
# import barcode
# from barcode.writer import ImageWriter
import base64
import logging
from io import BytesIO
import re
import unicodedata
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
class HrEmployee(models.Model):
_name = "event.speaker"
_inherit = ["mail.thread", "mail.activity.mixin"]
def _get_default_stage_id(self):
event_stages = self.env["event.speaker.stage"].search([])
return event_stages[0] if event_stages else False
name = fields.Char("Name", compute="_compute_name", store="True")
employee_id = fields.Many2one("hr.employee", string="Speaker")
discipline_id = fields.Many2one("event.discipline", string="Discipline")
working_hours = fields.Float("Working hours")
has_extra = fields.Boolean("Has Extra ?")
event_id = fields.Many2one("event.event", string="Event")
stage_id = fields.Many2one(
"event.speaker.stage",
ondelete="restrict",
default=_get_default_stage_id,
group_expand="_read_group_stage_ids",
tracking=True,
)
discipline_ids = fields.Many2many(
"event.discipline", string="discipline", related="employee_id.discipline_ids"
)
@api.model
def _read_group_stage_ids(self, stages, domain, order):
return self.env["event.speaker.stage"].search([])
@api.depends("employee_id", "discipline_id")
def _compute_name(self):
for record in self:
name = ""
if record.employee_id:
name += record.employee_id.name
if record.discipline_id:
name += " (%s)" % record.discipline_id.name
record.name = name

View File

@@ -1,38 +0,0 @@
from odoo import _, fields, models
class EventSpeakerStage(models.Model):
_name = "event.speaker.stage"
_description = "Speaker Stage"
_order = "sequence, name"
name = fields.Char(string="Stage Name", required=True, translate=True)
description = fields.Text(string="Stage description", translate=True)
sequence = fields.Integer("Sequence", default=1)
fold = fields.Boolean(string="Folded in Kanban", default=False)
pipe_end = fields.Boolean(
string="End Stage",
default=False,
help="Events will automatically be moved into this stage when they are finished. The event moved into this stage will automatically be set as green.",
)
legend_blocked = fields.Char(
"Red Kanban Label",
default=lambda s: _("Blocked"),
translate=True,
required=True,
help="Override the default value displayed for the blocked state for kanban selection.",
)
legend_done = fields.Char(
"Green Kanban Label",
default=lambda s: _("Ready for Next Stage"),
translate=True,
required=True,
help="Override the default value displayed for the done state for kanban selection.",
)
legend_normal = fields.Char(
"Grey Kanban Label",
default=lambda s: _("In Progress"),
translate=True,
required=True,
help="Override the default value displayed for the normal state for kanban selection.",
)

View File

@@ -1,7 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_speaker_user,event.event.speaker.user,learning_event_partner.model_event_speaker,event.group_event_user,1,0,0,0
access_event_speaker_manager,event.event.speaker.manager,learning_event_partner.model_event_speaker,event.group_event_manager,1,1,1,1
access_event_discipline_user,event.event.discipline.user,learning_event_partner.model_event_discipline,event.group_event_user,1,0,0,0
access_event_discipline_manager,event.event.discipline.manager,learning_event_partner.model_event_discipline,event.group_event_manager,1,1,1,1
access_event_speaker_stage_user,event.event.speaker.stage.user,learning_event_partner.model_event_speaker_stage,event.group_event_user,1,0,0,0
access_event_speaker_stage_manager,event.event.speaker.stage.manager,learning_event_partner.model_event_speaker_stage,event.group_event_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_event_speaker_user event.event.speaker.user learning_event_partner.model_event_speaker event.group_event_user 1 0 0 0
3 access_event_speaker_manager event.event.speaker.manager learning_event_partner.model_event_speaker event.group_event_manager 1 1 1 1
4 access_event_discipline_user event.event.discipline.user learning_event_partner.model_event_discipline event.group_event_user 1 0 0 0
5 access_event_discipline_manager event.event.discipline.manager learning_event_partner.model_event_discipline event.group_event_manager 1 1 1 1
6 access_event_speaker_stage_user event.event.speaker.stage.user learning_event_partner.model_event_speaker_stage event.group_event_user 1 0 0 0
7 access_event_speaker_stage_manager event.event.speaker.stage.manager learning_event_partner.model_event_speaker_stage event.group_event_manager 1 1 1 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -1,22 +0,0 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="view_event_form_inherit_learning_event_partner" model="ir.ui.view">
<field name="name">event.event.view.form.inherit</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(learning_event_partner.act_speakers_from_event)d"
type="action"
class="oe_stat_button"
icon="fa-users"
help="Speaker for this event">
<field name="nb_speakers" widget="statinfo" string="Speakers"/>
</button>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem name="Speaker Discipline"
id="menu_event_discipline"
sequence="1"
parent="event.menu_event_configuration"/>
<menuitem name="Speaker Stages"
id="event_speaker_stage_menu"
sequence="2"
parent="event.menu_event_configuration"/>
</odoo>

View File

@@ -1,141 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="act_speakers_from_event" model="ir.actions.act_window">
<field name="res_model">event.speaker</field>
<field name="name">Speakers</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('event_id', '=', active_id)]</field>
<field name="context">{'default_event_id': active_id}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No Speakers Yet !
</p><p>
Add new speakers to this event
</p>
</field>
</record>
<record id="event_speaker_view_search" model="ir.ui.view">
<field name="name">event.speaker.view.search</field>
<field name="model">event.speaker</field>
<field name="arch" type="xml">
<search string="Search Speakers">
<field name="name" string="Employee" filter_domain="[('name', 'ilike', self)]"/>
<field name="discipline_id"/>
<field name="has_extra"/>
<separator/>
<filter string="Unread Messages" name="message_needaction" domain="[('message_needaction', '=', True)]"/>
<separator/>
<filter invisible="1" string="Late Activities" name="activities_overdue" domain="[('my_activity_date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"/>
<filter invisible="1" string="Today Activities" name="activities_today" domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter invisible="1" string="Future Activities" name="activities_upcoming_all" domain="[('my_activity_date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))]"/>
<group expand="0" string="Group By">
<filter name="group_discipline" string="Discipline" domain="[]" context="{'group_by': 'discipline_id'}"/>
<filter name="group_employee" string="Speaker" domain="[]" context="{'group_by': 'employee_id'}"/>
</group>
<searchpanel>
<field name="discipline_id" icon="fa-address-card " enable_counters="1"/>
</searchpanel>
</search>
</field>
</record>
<record id="event_speaker_view_kanban" model="ir.ui.view">
<field name="name">event.speaker.kanban</field>
<field name="model">event.speaker</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<kanban class="o_event_attendee_kanban_view" default_group_by="stage_id" default_order="name, create_date desc" sample="1">
<field name="name"/>
<field name="employee_id"/>
<field name="stage_id"/>
<field name="has_extra" />
<field name="discipline_id"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_event_registration_kanban container-fluid p-0">
<div class="row h-100">
<div class="col-9 pr-0">
<div class="oe_kanban_content h-100">
<div class="o_kanban_record_body pt-1 pl-2 h-100 d-flex flex-column">
<b class="o_kanban_record_title"><field name="name"/></b>
<field name="event_id" invisible="context.get('default_event_id')" />
<span attrs="{'invisible': [('employee_id', '=', False)]}">By <field name="employee_id" /></span>
<div id="discipline_id" class="o_field_many2manytags o_field_widget d-flex mt-auto">
<t t-if="record.discipline_id.raw_value">
<div t-attf-class="badge badge-pill o_tag_color_#{(record.discipline_id.raw_value % 11) + 1}" >
<b><span class="o_badge_text"><t t-esc="record.discipline_id.value"/></span></b>
</div>
</t>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="event_speaker_view_tree" model="ir.ui.view">
<field name="name">event.speaker.view.tree</field>
<field name="model">event.speaker</field>
<field name="arch" type="xml">
<tree string="Speakers" editable="bottom">
<field name="name" invisible="0"/>
<field name="employee_id" />
<field name="discipline_id" />
<field name="event_id" invisible="1" />
<field name="has_extra"/>
<field name="working_hours" widget="float_time"/>
</tree>
</field>
</record>
<record id="event_speaker_view_form" model="ir.ui.view">
<field name="name">event.speaker.view.form</field>
<field name="model">event.speaker</field>
<field name="arch" type="xml">
<form string="Speaker">
<sheet>
<group>
<field name="name" readonly="1"/>
<group>
<field name="employee_id" required="1"/>
<field name="discipline_id" />
<field name="has_extra"/>
<field name="working_hours" widget="float_time"/>
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_event_discipline">
<field name="name">Speaker Discipline</field>
<field name="res_model">event.discipline</field>
</record>
<record id="menu_event_discipline" model="ir.ui.menu">
<field name="action" ref="learning_event_partner.action_event_discipline"/>
</record>
<record model="ir.actions.act_window" id="action_event_speaker_stage">
<field name="name">Speaker Stage</field>
<field name="res_model">event.speaker.stage</field>
</record>
<record id="event_speaker_stage_menu" model="ir.ui.menu">
<field name="action" ref="learning_event_partner.action_event_speaker_stage"/>
</record>
</data>
</odoo>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="disciplie_inherit_hr_employee" model="ir.ui.view">
<field name="name">hr.employee.view.form.discipline.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<field name="category_ids" position="after">
<field name="discipline_ids" placeholder="Discplines" widget="many2many_tags"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,109 @@
==========================
Survey contacts generation
==========================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0a298d1600a5f93ffe77357631c7e799e78b23b84c362b126720e36655dd5227
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fsurvey-lightgray.png?logo=github
:target: https://github.com/OCA/survey/tree/15.0/survey_contact_generation
:alt: OCA/survey
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_contact_generation
: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/survey&target_branch=15.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to generate new contacts from surveys answers.
**Table of contents**
.. contents::
:local:
Configuration
=============
To configure the contact generation:
#. Go to the configured survey.
#. In the *Contact* section of the *Options* tab, set
*Generate Contact* on, if you want contacts to be
generated from the answers to this survey.
#. In each question associated with a future new contact,
specify the corresponding contact field. To do this,
go to the 'Options' tab, then navigate to the 'Contact' group,
and select the 'Contact field' field.
Usage
=====
if the survey is properly configured, once it is submited
by an anonomous user, a new contact is create or an
existing one is linked.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/survey/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/survey/issues/new?body=module:%20survey_contact_generation%0Aversion:%2015.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
~~~~~~~
* Tecnativa
Contributors
~~~~~~~~~~~~
* `Tecnativa <https://www.tecnativa.com>`_
* David Vidal
* Ernesto Tejeda
* Stefan Ungureanu
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-chienandalu| image:: https://github.com/chienandalu.png?size=40px
:target: https://github.com/chienandalu
:alt: chienandalu
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-chienandalu|
This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/15.0/survey_contact_generation>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,24 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Survey contacts generation",
"summary": "Generate new contacts from surveys",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Marketing/Survey",
"website": "https://github.com/OCA/survey",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["clement_thomas"],
"license": "AGPL-3",
"depends": ["survey"],
"data": [
"views/survey_question_views.xml",
"views/survey_survey_views.xml",
],
"demo": ["demo/survey_contact_generation_demo.xml"],
"assets": {
"web.assets_tests": [
"/survey_contact_generation/static/tests/survey_contact_generation_tour.js",
],
},
}

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Survey-->
<record model="survey.survey" id="survey_contact_creation">
<field name="title">Contact Creation Survey</field>
<field name="access_token">80e5f1e2-1a9d-4c51-8e23-09e93f7fa2c5</field>
<field name="access_mode">public</field>
<field name="users_can_go_back" eval="True" />
<field name="generate_contact" eval="True" />
</record>
<record model="survey.question" id="survey_contact_q0">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">0</field>
<field name="title">Name</field>
<field name="question_type">char_box</field>
<field name="constr_mandatory" eval="True" />
<field name="res_partner_field" ref="base.field_res_partner__name" />
</record>
<record model="survey.question" id="survey_contact_q1">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">1</field>
<field name="title">Email</field>
<field name="question_type">char_box</field>
<field name="res_partner_field" ref="base.field_res_partner__email" />
</record>
<record model="survey.question" id="survey_contact_q2">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">2</field>
<field name="title">Notes</field>
<field name="question_type">text_box</field>
<field name="res_partner_field" ref="base.field_res_partner__comment" />
</record>
<record model="survey.question" id="survey_contact_q3">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">3</field>
<field name="title">Color</field>
<field name="question_type">numerical_box</field>
<field name="res_partner_field" ref="base.field_res_partner__color" />
</record>
<record model="survey.question" id="survey_contact_q4">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">4</field>
<field name="title">Date</field>
<field name="question_type">date</field>
<field name="res_partner_field" ref="base.field_res_partner__date" />
</record>
<record model="survey.question" id="survey_contact_q5">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">4</field>
<field name="title">Country</field>
<field name="question_type">simple_choice</field>
<field name="res_partner_field" ref="base.field_res_partner__country_id" />
</record>
<record model="survey.question.answer" id="survey_contact_q5_sug1">
<field name="question_id" ref="survey_contact_q5" />
<field name="sequence">1</field>
<field name="value">Spain</field>
<field name="res_partner_field_resource_ref" ref="base.es" />
</record>
<record model="survey.question.answer" id="survey_contact_q5_sug2">
<field name="question_id" ref="survey_contact_q5" />
<field name="sequence">2</field>
<field name="value">Romania</field>
<field name="res_partner_field_resource_ref" ref="base.ro" />
</record>
<record model="survey.question" id="survey_contact_q6">
<field name="survey_id" ref="survey_contact_creation" />
<field name="sequence">4</field>
<field name="title">Tags</field>
<field name="question_type">multiple_choice</field>
<field name="res_partner_field" ref="base.field_res_partner__category_id" />
</record>
<record model="survey.question.answer" id="survey_contact_q6_sug1">
<field name="question_id" ref="survey_contact_q6" />
<field name="sequence">1</field>
<field name="value">Vendor</field>
<field
name="res_partner_field_resource_ref"
ref="base.res_partner_category_0"
/>
</record>
<record model="survey.question.answer" id="survey_contact_q6_sug2">
<field name="question_id" ref="survey_contact_q6" />
<field name="sequence">2</field>
<field name="value">Prospects</field>
<field
name="res_partner_field_resource_ref"
ref="base.res_partner_category_2"
/>
</record>
<record model="survey.question.answer" id="survey_contact_q6_sug3">
<field name="question_id" ref="survey_contact_q6" />
<field name="sequence">3</field>
<field name="value">Employees</field>
<field
name="res_partner_field_resource_ref"
ref="base.res_partner_category_3"
/>
</record>
</odoo>

View File

@@ -0,0 +1,168 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_contact_generation
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-14 11:55+0000\n"
"PO-Revision-Date: 2023-06-14 13:58+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question__allowed_field_ids
msgid "Allowed Field"
msgstr "Campo permitido"
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q3
msgid "Color"
msgstr "Color"
#. module: survey_contact_generation
#: model_terms:ir.ui.view,arch_db:survey_contact_generation.survey_form
#: model_terms:ir.ui.view,arch_db:survey_contact_generation.survey_question_form
msgid "Contact"
msgstr "Contacto"
#. module: survey_contact_generation
#: model:survey.survey,title:survey_contact_generation.survey_contact_creation
msgid "Contact Creation Survey"
msgstr "Encuesta de creación de contactos"
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question__res_partner_field
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question_answer__res_partner_field
msgid "Contact field"
msgstr "Campo de contacto"
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question_answer__res_partner_field_resource_ref
msgid "Contact field value"
msgstr ""
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q5
msgid "Country"
msgstr ""
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q4
msgid "Date"
msgstr "Fecha"
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q1
msgid "Email"
msgstr "Correo electrónico"
#. module: survey_contact_generation
#: model:survey.question.answer,value:survey_contact_generation.survey_contact_q6_sug3
msgid "Employees"
msgstr ""
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_survey__generate_contact
msgid "Generate Contact"
msgstr "Generar contacto"
#. module: survey_contact_generation
#: model:ir.model.fields,help:survey_contact_generation.field_survey_survey__generate_contact
msgid "Generate contacts for anonymous survey users"
msgstr "Generar contacto para encuestas anónimas"
#. module: survey_contact_generation
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q0
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q1
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q2
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q3
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q4
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q5
#: model:survey.question,comments_message:survey_contact_generation.survey_contact_q6
msgid "If other, please specify:"
msgstr "Si es otro, especifíquelo:"
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q0
msgid "Name"
msgstr "Nombre"
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q2
msgid "Notes"
msgstr "Notas"
#. module: survey_contact_generation
#: model:survey.question.answer,value:survey_contact_generation.survey_contact_q6_sug2
msgid "Prospects"
msgstr ""
#. module: survey_contact_generation
#: model:survey.question.answer,value:survey_contact_generation.survey_contact_q5_sug2
msgid "Romania"
msgstr ""
#. module: survey_contact_generation
#: model:survey.question.answer,value:survey_contact_generation.survey_contact_q5_sug1
msgid "Spain"
msgstr ""
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_survey
msgid "Survey"
msgstr "Planificación"
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_question_answer
msgid "Survey Label"
msgstr ""
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_question
msgid "Survey Question"
msgstr "Pregunta de la encuesta"
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_user_input
msgid "Survey User Input"
msgstr "Entrada de usuario de la encuesta"
#. module: survey_contact_generation
#: model:survey.question,title:survey_contact_generation.survey_contact_q6
msgid "Tags"
msgstr ""
#. module: survey_contact_generation
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q0
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q1
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q2
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q3
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q4
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q5
#: model:survey.question,validation_error_msg:survey_contact_generation.survey_contact_q6
msgid "The answer you entered is not valid."
msgstr "La respuesta que has introducido no es válida."
#. module: survey_contact_generation
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q0
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q1
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q2
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q3
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q4
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q5
#: model:survey.question,constr_error_msg:survey_contact_generation.survey_contact_q6
msgid "This question requires an answer."
msgstr "Esta pregunta requiere una respuesta."
#. module: survey_contact_generation
#: model:survey.question.answer,value:survey_contact_generation.survey_contact_q6_sug1
msgid "Vendor"
msgstr ""

View File

@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_contact_generation
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-19 14:33+0000\n"
"PO-Revision-Date: 2023-09-19 14:33+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: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question__allowed_field_ids
msgid "Allowed Field"
msgstr "Champs autorisés"
#. module: survey_contact_generation
#: model_terms:ir.ui.view,arch_db:survey_contact_generation.survey_form
#: model_terms:ir.ui.view,arch_db:survey_contact_generation.survey_question_form
msgid "Contact"
msgstr ""
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question__res_partner_field
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question_answer__res_partner_field
msgid "Contact field"
msgstr "Champ contact"
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_question_answer__res_partner_field_resource_ref
msgid "Contact field value"
msgstr "Valeur du champ contact"
#. module: survey_contact_generation
#: model:ir.model.fields,field_description:survey_contact_generation.field_survey_survey__generate_contact
msgid "Generate Contact"
msgstr "Générer un contact"
#. module: survey_contact_generation
#: model:ir.model.fields,help:survey_contact_generation.field_survey_survey__generate_contact
msgid "Generate contacts for anonymous survey users"
msgstr "Générer des contacts pour les questionnaires anonymes"
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_question_answer
msgid "Survey Label"
msgstr "Étiquette du questionnaire"
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_question
msgid "Survey Question"
msgstr "Question du questionnaire"
#. module: survey_contact_generation
#: model:ir.model,name:survey_contact_generation.model_survey_user_input
msgid "Survey User Input"
msgstr "Entrée utilisateur du questionnaire"

View File

@@ -0,0 +1,3 @@
from . import survey_question
from . import survey_survey
from . import survey_user_input

View File

@@ -0,0 +1,80 @@
# Copyright 2022 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class SurveyQuestion(models.Model):
_inherit = "survey.question"
allowed_field_ids = fields.Many2many(
comodel_name="ir.model.fields",
compute="_compute_allowed_field_ids",
)
res_partner_field = fields.Many2one(
string="Contact field",
comodel_name="ir.model.fields",
domain="[('id', 'in', allowed_field_ids)]",
)
@api.depends("question_type")
def _compute_allowed_field_ids(self):
type_mapping = {
"char_box": ["char", "text"],
"text_box": ["html"],
"numerical_box": ["integer", "float", "html", "char"],
"date": ["date", "text", "char"],
"datetime": ["datetime", "html", "char"],
"simple_choice": ["many2one", "html", "char"],
"multiple_choice": ["many2many", "html", "char"],
}
for record in self:
record.allowed_field_ids = (
self.env["ir.model.fields"]
.search(
[
("model", "=", "res.partner"),
("ttype", "in", type_mapping.get(record.question_type, [])),
]
)
.ids
)
class SurveyQuestionAnswer(models.Model):
_inherit = "survey.question.answer"
@api.model
def default_get(self, fields):
result = super().default_get(fields)
if (
not result.get("res_partner_field")
or "res_partner_field_resource_ref" not in fields
):
return result
partner_field = self.env["ir.model.fields"].browse(result["res_partner_field"])
# Otherwise we'll just use the value (char, text)
if partner_field.ttype not in {"many2one", "many2many"}:
return result
res = self.env[partner_field.relation].search([], limit=1)
if res:
result["res_partner_field_resource_ref"] = "%s,%s" % (
partner_field.relation,
res.id,
)
return result
@api.model
def _selection_res_partner_field_resource_ref(self):
return [(model.model, model.name) for model in self.env["ir.model"].search([])]
res_partner_field = fields.Many2one(related="question_id.res_partner_field")
res_partner_field_resource_ref = fields.Reference(
string="Contact field value",
selection="_selection_res_partner_field_resource_ref",
)
@api.onchange("res_partner_field_resource_ref")
def _onchange_res_partner_field_resource_ref(self):
"""Set the default value as the product name, although we can change it"""
if self.res_partner_field_resource_ref:
self.value = self.res_partner_field_resource_ref.display_name or ""

View File

@@ -0,0 +1,11 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class SurveySurvey(models.Model):
_inherit = "survey.survey"
generate_contact = fields.Boolean(
help="Generate contacts for anonymous survey users",
)

View File

@@ -0,0 +1,77 @@
# Copyright 2022 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class SurveyUserInput(models.Model):
_inherit = "survey.user_input"
def _prepare_partner(self):
"""Extract partner values from the answers"""
self.ensure_one()
elegible_inputs = self.user_input_line_ids.filtered(
lambda x: x.question_id.res_partner_field and not x.skipped
)
basic_inputs = elegible_inputs.filtered(
lambda x: x.answer_type not in {"suggestion"}
and x.question_id.res_partner_field.name != "comment"
)
vals = {
line.question_id.res_partner_field.name: line[f"value_{line.answer_type}"]
for line in basic_inputs
}
for line in elegible_inputs - basic_inputs:
field_name = line.question_id.res_partner_field.name
if line.question_id.res_partner_field.ttype == "many2one":
vals[
field_name
] = line.suggested_answer_id.res_partner_field_resource_ref.id
elif line.question_id.res_partner_field.ttype == "many2many":
vals.setdefault(field_name, [])
vals[field_name] += [
(4, line.suggested_answer_id.res_partner_field_resource_ref.id)
]
# We'll use the comment field to add any other infos
elif field_name == "comment":
vals.setdefault("comment", "")
value = (
line.suggested_answer_id.value
if line.answer_type == "suggestion"
else line[f"value_{line.answer_type}"]
)
vals["comment"] += f"\n{line.question_id.title}: {value}"
else:
if line.question_id.question_type == "multiple_choice":
if not vals.get(field_name):
vals[field_name] = line.suggested_answer_id.value
else:
vals[field_name] += line.suggested_answer_id.value
else:
vals[field_name] = line.suggested_answer_id.value
return vals
def _create_contact_post_process(self, partner):
"""After creating the lead send an internal message with the input link"""
partner.message_post_with_view(
"mail.message_origin_link",
values={"self": partner, "origin": self.survey_id},
subtype_id=self.env.ref("mail.mt_note").id,
)
def _mark_done(self):
"""Generate the contact when the survey is submitted"""
for user_input in self.filtered(
lambda r: r.survey_id.generate_contact# and not self.partner_id #uncomment to avoid contact generation several times
):
vals = user_input._prepare_partner()
partner = False
email = vals.get("email")
if email:
partner = self.env["res.partner"].search(
[("email", "=", email)], limit=1
)
if not partner:
partner = self.env["res.partner"].create(vals)
self._create_contact_post_process(partner)
self.update({"partner_id": partner.id, "email": partner.email})
return super()._mark_done()

View File

@@ -0,0 +1,10 @@
To configure the contact generation:
#. Go to the configured survey.
#. In the *Contact* section of the *Options* tab, set
*Generate Contact* on, if you want contacts to be
generated from the answers to this survey.
#. In each question associated with a future new contact,
specify the corresponding contact field. To do this,
go to the 'Options' tab, then navigate to the 'Contact' group,
and select the 'Contact field' field.

View File

@@ -0,0 +1,5 @@
* `Tecnativa <https://www.tecnativa.com>`_
* David Vidal
* Ernesto Tejeda
* Stefan Ungureanu

View File

@@ -0,0 +1 @@
This module allows to generate new contacts from surveys answers.

View File

@@ -0,0 +1,3 @@
if the survey is properly configured, once it is submited
by an anonomous user, a new contact is create or an
existing one is linked.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -0,0 +1,450 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Survey contacts generation</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="survey-contacts-generation">
<h1 class="title">Survey contacts generation</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0a298d1600a5f93ffe77357631c7e799e78b23b84c362b126720e36655dd5227
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/survey/tree/15.0/survey_contact_generation"><img alt="OCA/survey" src="https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_contact_generation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/survey&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to generate new contacts from surveys answers.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure the contact generation:</p>
<ol class="arabic simple">
<li>Go to the configured survey.</li>
<li>In the <em>Contact</em> section of the <em>Options</em> tab, set
<em>Generate Contact</em> on, if you want contacts to be
generated from the answers to this survey.</li>
<li>In each question associated with a future new contact,
specify the corresponding contact field. To do this,
go to the Options tab, then navigate to the Contact group,
and select the Contact field field.</li>
</ol>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>if the survey is properly configured, once it is submited
by an anonomous user, a new contact is create or an
existing one is linked.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/survey/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/survey/issues/new?body=module:%20survey_contact_generation%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
<li>David Vidal</li>
<li>Ernesto Tejeda</li>
<li>Stefan Ungureanu</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/survey/tree/15.0/survey_contact_generation">OCA/survey</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,82 @@
odoo.define("survey.tour_test_survey_contact_generation", function (require) {
"use strict";
const tour = require("web_tour.tour");
tour.register(
"test_survey_contact_generation",
{
test: true,
url: "/survey/start/80e5f1e2-1a9d-4c51-8e23-09e93f7fa2c5",
},
[
{
content: "Click on Start",
trigger: "button.btn:contains('Start Survey')",
},
{
content: "Name",
trigger: "div.js_question-wrapper:contains('Name') input",
run: "text My Name",
},
{
content: "Email",
trigger: "div.js_question-wrapper:contains('Email') input",
run: "text survey_contact_generation@test.com",
},
{
content: "Notes",
trigger: "div.js_question-wrapper:contains('Notes') textarea",
run: "text This is a test note",
},
{
content: "Color",
trigger: "div.js_question-wrapper:contains('Color') input",
run: "text 1",
},
{
content: "Date",
trigger: "div.js_question-wrapper:contains('Date') input",
run: "text 01/01/2023",
},
{
content: "Country",
trigger:
"div.js_question-wrapper:contains('Country') label:contains('Romania') i",
run: function () {
$(
"div.js_question-wrapper:contains('Country') label:contains('Romania') i"
).prop("checked", true);
},
},
{
content: "Tags",
trigger:
"div.js_question-wrapper:contains('Tags') label:contains('Prospects') i",
run: function () {
$(
"div.js_question-wrapper:contains('Tags') label:contains('Prospects') i"
).prop("checked", true);
},
},
{
content: "Tags",
trigger:
"div.js_question-wrapper:contains('Tags') label:contains('Vendor') i",
run: function () {
$(
"div.js_question-wrapper:contains('Tags') label:contains('Vendor') i"
).prop("checked", true);
},
},
{
content: "Click Submit",
trigger: "button[value='finish']",
},
{
content: "Thank you",
trigger: "h1:contains('Thank you!')",
},
]
);
});

View File

@@ -0,0 +1 @@
from . import test_survey_contact_generation

View File

@@ -0,0 +1,31 @@
# Copyright 2023 Tecnativa - David Vidal
# Copyright 2023 Tecnativa - Stefan Ungureanu
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import HttpCase, tagged
from odoo.addons.survey.tests.common import SurveyCase
@tagged("-at_install", "post_install")
class SurveyContactGenerationCase(SurveyCase, HttpCase):
def setUp(self):
"""We run the tour in the setup so we can share the tests case with other
modules"""
super().setUp()
self.survey = self.env.ref("survey_contact_generation.survey_contact_creation")
initial_user_inputs = self.survey.user_input_ids
# Run the survey as a portal user and get the generated quotation
self.start_tour(
f"/survey/start/{self.survey.access_token}",
"test_survey_contact_generation",
)
self.user_input = self.survey.user_input_ids - initial_user_inputs
@tagged("-at_install", "post_install")
class SurveyContactGenerationTests(SurveyContactGenerationCase):
def test_contact_generation(self):
partner = self.env["res.partner"].search(
[("email", "=", "survey_contact_generation@test.com")]
)
self.assertEqual(partner, self.user_input.partner_id)

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="survey_question_form" model="ir.ui.view">
<field name="model">survey.question</field>
<field name="inherit_id" ref="survey.survey_question_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='comments_allowed']/.." position="after">
<group name="contact" string="Contact">
<field name="res_partner_field" widget="selection" />
<field name="allowed_field_ids" invisible="1" />
</group>
</xpath>
<xpath expr="//field[@name='suggested_answer_ids']" position="attributes">
<attribute
name="context"
>{'default_question_id': active_id, 'default_res_partner_field': res_partner_field}</attribute>
</xpath>
<xpath
expr="//field[@name='suggested_answer_ids']//field[@name='value']"
position="after"
>
<field name="res_partner_field" invisible="1" />
<field
name="res_partner_field_resource_ref"
readonly="False"
options="{'hide_model': True, 'no_create': True, 'no_edit': True, 'no_open': True}"
attrs="{'column_invisible': [('parent.res_partner_field', '=', False)]}"
/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="survey_form" model="ir.ui.view">
<field name="model">survey.survey</field>
<field name="inherit_id" ref="survey.survey_survey_view_form" />
<field name="arch" type="xml">
<group name="options" position="inside">
<group name="contact_options" string="Contact">
<field name="generate_contact" />
</group>
</group>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,105 @@
=======================
Survey leads generation
=======================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:72ceb1068020aaec4baba6df86a6b1b024793db57bdfc2cec8374da9cac8d031
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fsurvey-lightgray.png?logo=github
:target: https://github.com/OCA/survey/tree/15.0/survey_crm_generation
:alt: OCA/survey
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_crm_generation
: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/survey&target_branch=15.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to generate leads/opportunities from surveys.
**Table of contents**
.. contents::
:local:
Configuration
=============
To configure the leads/opportunities generation:
#. Go to the configured survey.
#. In the *CRM* section of the *Options* tab, set *Generate leads* on.
#. Optionally you can set default tags for the generated leads.
#. You can set the crm team to assign the leads to.
The questions marked to be shown in the lead description will be shown there.
Usage
=====
Once the surveys are submited a lead/opportunity (depending on the default options for
the company) will be generated with a link to the answers.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/survey/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/survey/issues/new?body=module:%20survey_crm_generation%0Aversion:%2015.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
~~~~~~~
* Tecnativa
Contributors
~~~~~~~~~~~~
* `Tecnativa <https://www.tecnativa.com>`_
* David Vidal
* Stefan ungureanu
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-chienandalu| image:: https://github.com/chienandalu.png?size=40px
:target: https://github.com/chienandalu
:alt: chienandalu
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-chienandalu|
This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/15.0/survey_crm_generation>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,26 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Survey leads generation",
"summary": "Generate CRM leads/opportunities from surveys",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Marketing/Survey",
"website": "https://github.com/OCA/survey",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["chienandalu"],
"license": "AGPL-3",
"depends": ["survey", "crm"],
"data": [
"views/survey_survey_views.xml",
"views/survey_question_views.xml",
"views/survey_user_input_views.xml",
"views/crm_lead_views.xml",
],
"demo": ["demo/survey_crm_demo.xml"],
"assets": {
"web.assets_tests": [
"/survey_crm_generation/static/tests/survey_crm_generation_tour.js",
],
},
}

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="crm.tag" id="tag_survey_leads">
<field name="name">Survey Leads</field>
</record>
<record model="crm.tag" id="tag_oca_partnership">
<field name="name">OCA Partnership</field>
</record>
<!-- Sales Team -->
<record model="crm.team" id="oca_partnership_leads">
<field name="name">OCA Partnership</field>
</record>
<!-- Survey -->
<record model="survey.survey" id="become_partner">
<field name="title">Become OCA Partner</field>
<field name="description">Be part of the Odoo Community!</field>
<field name="access_token">08b4db21-66cc-4c69-a712-cc364c54902c</field>
<field name="access_mode">public</field>
<field name="generate_leads" eval="True" />
<field name="crm_team_id" ref="oca_partnership_leads" />
<field
name="crm_tag_ids"
eval="[(6,0,[ref('survey_crm_generation.tag_oca_partnership'), ref('survey_crm_generation.tag_survey_leads')])]"
/>
<field name="users_can_go_back" eval="True" />
</record>
<record model="survey.question" id="survey_oca_q0">
<field name="survey_id" ref="become_partner" />
<field name="sequence">0</field>
<field name="title">E-mail address</field>
<field name="question_type">text_box</field>
<field name="show_in_lead_description" eval="True" />
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="survey_oca_q1">
<field name="survey_id" ref="become_partner" />
<field name="sequence">1</field>
<field name="title">Your company name?</field>
<field name="question_type">text_box</field>
<field name="show_in_lead_description" eval="True" />
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="survey_oca_q3">
<field name="survey_id" ref="become_partner" />
<field name="sequence">2</field>
<field name="title">And your name?</field>
<field name="question_type">text_box</field>
<field name="show_in_lead_description" eval="True" />
<field name="constr_mandatory" eval="True" />
</record>
</odoo>

View File

@@ -0,0 +1,137 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_crm_generation
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-01 09:49+0000\n"
"PO-Revision-Date: 2023-06-01 12:07+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"
#. module: survey_crm_generation
#: model:survey.question,title:survey_crm_generation.survey_oca_q3
msgid "And your name?"
msgstr "¿Y tu nombre? "
#. module: survey_crm_generation
#: model:survey.survey,description:survey_crm_generation.become_partner
msgid "Be part of the Odoo Community!"
msgstr "¡Se parte de la comunidad de Odoo!"
#. module: survey_crm_generation
#: model:survey.survey,title:survey_crm_generation.become_partner
msgid "Become OCA Partner"
msgstr "Conviértete en miembro OCA"
#. module: survey_crm_generation
#: model_terms:ir.ui.view,arch_db:survey_crm_generation.survey_form
#: model_terms:ir.ui.view,arch_db:survey_crm_generation.survey_question_form
msgid "CRM"
msgstr "CRM"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__crm_tag_ids
msgid "Crm Tag"
msgstr "Etiqueta CRM"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__crm_team_id
msgid "Crm Team"
msgstr "Equipo CRM"
#. module: survey_crm_generation
#: model:survey.question,title:survey_crm_generation.survey_oca_q0
msgid "E-mail address"
msgstr "Dirección de correo electrónico"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__generate_leads
msgid "Generate Leads"
msgstr "Generación de iniciativa"
#. module: survey_crm_generation
#: model:ir.model.fields,help:survey_crm_generation.field_survey_survey__generate_leads
msgid "Generate leads/opportunities linked to the generated quotations"
msgstr "Generar iniciativas/oportunidades vinculadas a las ofertas generadas"
#. module: survey_crm_generation
#: model:survey.question,comments_message:survey_crm_generation.survey_oca_q0
#: model:survey.question,comments_message:survey_crm_generation.survey_oca_q1
#: model:survey.question,comments_message:survey_crm_generation.survey_oca_q3
msgid "If other, please specify:"
msgstr "Si es otro, especifíquelo:"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Iniciativa/Oportunidad"
#. module: survey_crm_generation
#: model:crm.tag,name:survey_crm_generation.tag_oca_partnership
#: model:crm.team,name:survey_crm_generation.oca_partnership_leads
msgid "OCA Partnership"
msgstr "Asociación OCA"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_user_input__opportunity_id
msgid "Opportunity"
msgstr "Oportunidad"
#. module: survey_crm_generation
#: model:ir.model.fields,help:survey_crm_generation.field_survey_survey__crm_tag_ids
msgid "Set the default crm tags in the generated leads/opportunities"
msgstr "Establecer las etiquetas crm por defecto en las iniciativas/oportunidades generadas"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_question__show_in_lead_description
msgid "Show In Lead Description"
msgstr "Mostrar en la descripción de la iniciativa"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_survey_survey
msgid "Survey"
msgstr "Encuesta"
#. module: survey_crm_generation
#: model:crm.tag,name:survey_crm_generation.tag_survey_leads
msgid "Survey Leads"
msgstr "Encuesta de la iniciativa"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_survey_question
msgid "Survey Question"
msgstr "Pregunta de la encuesta"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_survey_user_input
#: model:ir.model.fields,field_description:survey_crm_generation.field_crm_lead__survey_user_input_id
msgid "Survey User Input"
msgstr "Respuestas de los usuarios"
#. module: survey_crm_generation
#: model:survey.question,validation_error_msg:survey_crm_generation.survey_oca_q0
#: model:survey.question,validation_error_msg:survey_crm_generation.survey_oca_q1
#: model:survey.question,validation_error_msg:survey_crm_generation.survey_oca_q3
msgid "The answer you entered is not valid."
msgstr "La respuesta que has introducido no es válida."
#. module: survey_crm_generation
#: model:survey.question,constr_error_msg:survey_crm_generation.survey_oca_q0
#: model:survey.question,constr_error_msg:survey_crm_generation.survey_oca_q1
#: model:survey.question,constr_error_msg:survey_crm_generation.survey_oca_q3
msgid "This question requires an answer."
msgstr "Esta pregunta requiere una respuesta."
#. module: survey_crm_generation
#: model:survey.question,title:survey_crm_generation.survey_oca_q1
msgid "Your company name?"
msgstr "¿El nombre de su empresa?"

View File

@@ -0,0 +1,85 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_crm_generation
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-24 08:50+0000\n"
"PO-Revision-Date: 2023-10-24 08:50+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: survey_crm_generation
#: model_terms:ir.ui.view,arch_db:survey_crm_generation.survey_form
#: model_terms:ir.ui.view,arch_db:survey_crm_generation.survey_question_form
msgid "CRM"
msgstr ""
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__crm_tag_ids
msgid "Crm Tag"
msgstr "Étiquette CRM"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__crm_team_id
msgid "Crm Team"
msgstr "Équipe commerciale"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__generate_leads
msgid "Generate Leads"
msgstr "Générer des pistes"
#. module: survey_crm_generation
#: model:ir.model.fields,help:survey_crm_generation.field_survey_survey__generate_leads
msgid "Generate leads/opportunities linked to the generated quotations"
msgstr "Générer des pistes / opportunités liées aux devis"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Piste/Opportunité"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_user_input__opportunity_id
msgid "Opportunity"
msgstr "Opportunité"
#. module: survey_crm_generation
#: model:ir.model.fields,help:survey_crm_generation.field_survey_survey__crm_tag_ids
msgid "Set the default crm tags in the generated leads/opportunities"
msgstr "Attribuer les étiquettes par défault dans les pistes générées"
#. module: survey_crm_generation
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_question__show_in_lead_description
msgid "Show In Lead Description"
msgstr "Montrer dans la description de la piste CRM"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_survey_survey
msgid "Survey"
msgstr "Questionnaire"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_survey_question
msgid "Survey Question"
msgstr "Question du questionnaire"
#. module: survey_crm_generation
#: model:ir.model,name:survey_crm_generation.model_survey_user_input
#: model:ir.model.fields,field_description:survey_crm_generation.field_crm_lead__survey_user_input_id
msgid "Survey User Input"
msgstr "Entrée utilisateur du questionnaire"
#. module: survey_crm_generation
#. odoo-python
#: code:addons/survey_crm_generation/models/survey_user_input.py:0
#, python-format
msgid "Survey answers: "
msgstr "Réponses au questionnaire : "

View File

@@ -0,0 +1,4 @@
from . import crm_lead
from . import survey_question
from . import survey_survey
from . import survey_user_input

View File

@@ -0,0 +1,9 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class CrmLead(models.Model):
_inherit = "crm.lead"
survey_user_input_id = fields.Many2one(comodel_name="survey.user_input")

View File

@@ -0,0 +1,9 @@
# Copyright 2022 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class SurveyQuestion(models.Model):
_inherit = "survey.question"
show_in_lead_description = fields.Boolean()

View File

@@ -0,0 +1,16 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class SurveySurvey(models.Model):
_inherit = "survey.survey"
generate_leads = fields.Boolean(
help="Generate leads/opportunities linked to the generated quotations",
)
crm_tag_ids = fields.Many2many(
comodel_name="crm.tag",
help="Set the default crm tags in the generated leads/opportunities",
)
crm_team_id = fields.Many2one(comodel_name="crm.team")

View File

@@ -0,0 +1,73 @@
# Copyright 2022 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models, _
class SurveyUserInput(models.Model):
_inherit = "survey.user_input"
opportunity_id = fields.Many2one(comodel_name="crm.lead")
def _prepare_opportunity(self):
return {
"name": self.survey_id.title,
"tag_ids": [(6, 0, self.survey_id.crm_tag_ids.ids)],
"partner_id": self.partner_id.id,
"user_id": self.survey_id.crm_team_id.user_id.id,
"team_id": self.survey_id.crm_team_id.id,
"company_id": self.create_uid.company_id.id,
"survey_user_input_id": self.id,
"description": self._prepare_lead_description(),
}
def _prepare_lead_description(self):
"""We can have surveys without partner. It's handy to have some relevant info
in the description although the answers are linked themselves.
:return str: description for the lead
"""
relevant_answers = self.user_input_line_ids.filtered(
lambda x: not x.skipped and x.question_id.show_in_lead_description
)
li = ''
for answer in relevant_answers:
li += '<li>'
answer_value = answer[f'value_{answer.answer_type}']
#case of value Models
if isinstance(answer_value,models.Model):
# case of Multi Models
if len(answer_value._ids) > 1:
ul2 = f'{answer.question_id.title}: <ul>'
for answer_value_object in answer_value:
ul2 += '<li>'+f"{answer_value_object.display_name}"+'</li>'
ul2 += '</ul>'
li += ul2
# case of One Models
else:
li += f"{answer.question_id.title}: {answer_value.display_name}"
else:
# case of string value
li += f"{answer.question_id.title}: {answer_value}"
li += '</li>'
description = '<u>'+_('Survey answers: ')+"</u><ul>"+li+"</ul>"
return description
def _create_opportunity_post_process(self):
"""After creating the lead send an internal message with the input link"""
self.opportunity_id.message_post_with_view(
"mail.message_origin_link",
values={"self": self.opportunity_id, "origin": self},
subtype_id=self.env.ref("mail.mt_note").id,
)
def _mark_done(self):
"""Generate the opportunity when the survey is submitted"""
res = super()._mark_done()
if not self.survey_id.generate_leads:
return res
vals = self._prepare_opportunity()
self.opportunity_id = self.env["crm.lead"].sudo().create(vals)
self._create_opportunity_post_process()
return res

View File

@@ -0,0 +1,8 @@
To configure the leads/opportunities generation:
#. Go to the configured survey.
#. In the *CRM* section of the *Options* tab, set *Generate leads* on.
#. Optionally you can set default tags for the generated leads.
#. You can set the crm team to assign the leads to.
The questions marked to be shown in the lead description will be shown there.

View File

@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_
* David Vidal
* Stefan ungureanu

View File

@@ -0,0 +1 @@
This module allows to generate leads/opportunities from surveys.

View File

@@ -0,0 +1,2 @@
Once the surveys are submited a lead/opportunity (depending on the default options for
the company) will be generated with a link to the answers.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -0,0 +1,445 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Survey leads generation</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="survey-leads-generation">
<h1 class="title">Survey leads generation</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:72ceb1068020aaec4baba6df86a6b1b024793db57bdfc2cec8374da9cac8d031
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/survey/tree/15.0/survey_crm_generation"><img alt="OCA/survey" src="https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_crm_generation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/survey&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to generate leads/opportunities from surveys.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure the leads/opportunities generation:</p>
<ol class="arabic simple">
<li>Go to the configured survey.</li>
<li>In the <em>CRM</em> section of the <em>Options</em> tab, set <em>Generate leads</em> on.</li>
<li>Optionally you can set default tags for the generated leads.</li>
<li>You can set the crm team to assign the leads to.</li>
</ol>
<p>The questions marked to be shown in the lead description will be shown there.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>Once the surveys are submited a lead/opportunity (depending on the default options for
the company) will be generated with a link to the answers.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/survey/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/survey/issues/new?body=module:%20survey_crm_generation%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
<li>David Vidal</li>
<li>Stefan ungureanu</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/survey/tree/15.0/survey_crm_generation">OCA/survey</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,48 @@
odoo.define(
"survey_crm_generation.tour_test_survey_crm_generation",
function (require) {
"use strict";
const tour = require("web_tour.tour");
tour.register(
"test_survey_crm_generation",
{
test: true,
url: "/survey/start/08b4db21-66cc-4c69-a712-cc364c54902c",
},
[
{
content: "Start Survey",
trigger: "button.btn:contains('Start Survey')",
},
{
content: "E-mail address",
trigger:
"div.js_question-wrapper:contains('E-mail address') textarea",
run: "text test@test.com",
},
{
content: "Your company name?",
trigger:
"div.js_question-wrapper:contains('Your company name?') textarea",
run: "text Tecnativa",
},
{
content: "And your name?",
trigger:
"div.js_question-wrapper:contains('And your name?') textarea",
run: "text Tecnativa",
},
{
content: "Click Submit",
trigger: "button[value='finish']",
},
{
content: "Thank you",
trigger: "h1:contains('Thank you!')",
},
]
);
}
);

View File

@@ -0,0 +1 @@
from . import test_survey_crm_sale_generation

View File

@@ -0,0 +1,49 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from markupsafe import Markup
from odoo.tests import HttpCase, tagged
from odoo.addons.survey.tests.common import SurveyCase
@tagged("-at_install", "post_install")
class SurveyCrmGenerationCase(SurveyCase, HttpCase):
def setUp(self):
"""We run the tour in the setup so we can share the tests case with other
modules"""
super().setUp()
self.oca_leads = self.env.ref("survey_crm_generation.oca_partnership_leads")
self.survey = self.env.ref("survey_crm_generation.become_partner")
initial_user_inputs = self.survey.user_input_ids
# Run the survey as a portal user and get the generated quotation
self.start_tour(
f"/survey/start/{self.survey.access_token}",
"test_survey_crm_generation",
login="portal",
)
self.user_input = self.survey.user_input_ids - initial_user_inputs
self.generated_lead = self.user_input.opportunity_id
@tagged("-at_install", "post_install")
class SurveyCrmGenerationTests(SurveyCrmGenerationCase):
def test_lead_generation(self):
self.assertFalse(self.generated_lead.stage_id.is_won)
self.assertEqual(self.generated_lead.team_id, self.oca_leads)
self.assertEqual(
self.generated_lead.tag_ids,
(
self.env.ref("survey_crm_generation.tag_oca_partnership")
+ self.env.ref("survey_crm_generation.tag_survey_leads")
),
)
expected_lead_description = Markup(
"<p>E-mail address: test@test.com\n"
"Your company name?: Tecnativa\n"
"And your name?: Tecnativa</p>"
)
self.assertEqual(
self.generated_lead.description,
expected_lead_description,
)

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="crm_lead_view_form" model="ir.ui.view">
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form" />
<field name="arch" type="xml">
<field name="tag_ids" position="after">
<field
string="Created from survey"
name="survey_user_input_id"
attrs="{'invisible': [('survey_user_input_id', '=', False)]}"
readonly="1"
/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="survey_question_form" model="ir.ui.view">
<field name="model">survey.question</field>
<field name="inherit_id" ref="survey.survey_question_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='comments_allowed']/.." position="after">
<group name="crm" string="CRM">
<field
name="show_in_lead_description"
attrs="{'invisible': [('question_type', 'in', ['matrix', 'simple_choice', 'multiple_choice'])]}"
/>
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="survey_form" model="ir.ui.view">
<field name="model">survey.survey</field>
<field name="inherit_id" ref="survey.survey_survey_view_form" />
<field name="arch" type="xml">
<group name="options" position="inside">
<group name="crm_options" string="CRM">
<field name="generate_leads" />
<field
name="crm_team_id"
attrs="{'invisible': [('generate_leads', '=', False)]}"
/>
<field
name="crm_tag_ids"
widget="many2many_tags"
attrs="{'invisible': [('generate_leads', '=', False)]}"
/>
</group>
</group>
</field>
</record>
</odoo>

Some files were not shown because too many files have changed in this diff Show More