[NEW] training-tools addons

This commit is contained in:
clementthomas
2023-06-15 11:55:37 +02:00
parent e96bc23168
commit 387f068fd5
44 changed files with 2329 additions and 0 deletions

91
learning_base/README.rst Normal file
View File

@@ -0,0 +1,91 @@
.. 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

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

View File

@@ -0,0 +1,34 @@
# -*- 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',
'ir_module_category_records.xml',
'views/product_template.xml',
'views/event_event.xml',
'views/res_company.xml',
'views/res_partner.xml',
'views/template.xml',
],
}

View File

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

View File

@@ -0,0 +1,343 @@
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)

368
learning_base/i18n/fr.po Normal file
View File

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

@@ -0,0 +1,76 @@
<?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">[('is_learning', '=', 1)]</field>
<field name="context">{'default_is_learning': 1}</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

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="ir_module_category_formation_r0" model="ir.module.category">
<field name="name">Formation</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,14 @@
<?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

@@ -0,0 +1,6 @@
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

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

@@ -0,0 +1,20 @@
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

@@ -0,0 +1,64 @@
# 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(compute='_compute_is_learning')
detailed_type = fields.Selection(selection_add=[
('learning', 'Training'),
], ondelete={'learning': 'set service'})
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)]))
@api.depends('detailed_type')
def _compute_is_learning(self):
for record in self:
record.is_learning = record.detailed_type == 'learning'

View File

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

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

@@ -0,0 +1,14 @@
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

@@ -0,0 +1,16 @@
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

@@ -0,0 +1,52 @@
<?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.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -0,0 +1,40 @@
<?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

@@ -0,0 +1,100 @@
<?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>
<page name="sales" position="after">
<page string="Learning" attrs="{'invisible':[('detailed_type','!=','learning')]}" 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

@@ -0,0 +1,23 @@
<?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

@@ -0,0 +1,22 @@
<?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

@@ -0,0 +1,48 @@
<?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>