Initial commit: Test packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 080accd21c
338 changed files with 32413 additions and 0 deletions

View file

@ -0,0 +1,54 @@
# Test Full eLearning Flow
This module will test the main certification flow of Odoo.
It will install the e-learning, survey and e-commerce apps and make a complete
certification flow including purchase, certification, failure and success.
## Installation
```bash
pip install odoo-bringout-oca-ocb-test_website_slides_full
```
## Dependencies
This addon depends on:
- website_sale_product_configurator
- website_sale_slides
- website_slides_forum
- website_slides_survey
- payment_demo
## Manifest Information
- **Name**: Test Full eLearning Flow
- **Version**: 1.0
- **Category**: Hidden/Tests
- **License**: LGPL-3
- **Installable**: True
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `test_website_slides_full`.
## License
This package maintains the original LGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Reports: doc/REPORTS.md
- Security: doc/SECURITY.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph Test_website_slides_full Module - test_website_slides_full
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for test_website_slides_full. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,9 @@
# Dependencies
This addon depends on:
- [website_sale_product_configurator](../../odoo-bringout-oca-ocb-website_sale_product_configurator)
- [website_sale_slides](../../odoo-bringout-oca-ocb-website_sale_slides)
- [website_slides_forum](../../odoo-bringout-oca-ocb-website_slides_forum)
- [website_slides_survey](../../odoo-bringout-oca-ocb-website_slides_survey)
- [payment_demo](../../odoo-bringout-oca-ocb-payment_demo)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon test_website_slides_full or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-ocb-test_website_slides_full"
# or
uv pip install odoo-bringout-oca-ocb-test_website_slides_full"
```

View file

@ -0,0 +1,11 @@
# Models
Detected core models and extensions in test_website_slides_full.
```mermaid
classDiagram
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: test_website_slides_full. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon test_website_slides_full
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,8 @@
# Security
This module does not define custom security rules or access controls beyond Odoo defaults.
Default Odoo security applies:
- Base user access through standard groups
- Model access inherited from dependencies
- No custom row-level security rules

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon test_website_slides_full
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,46 @@
[project]
name = "odoo-bringout-oca-ocb-test_website_slides_full"
version = "16.0.0"
description = "Test Full eLearning Flow - Odoo addon"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-website_sale_product_configurator>=16.0.0",
"odoo-bringout-oca-ocb-website_sale_slides>=16.0.0",
"odoo-bringout-oca-ocb-website_slides_forum>=16.0.0",
"odoo-bringout-oca-ocb-website_slides_survey>=16.0.0",
"odoo-bringout-oca-ocb-payment_demo>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["test_website_slides_full"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]

View file

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

View file

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Test Full eLearning Flow',
'version': '1.0',
'category': 'Hidden/Tests',
'description': """
This module will test the main certification flow of Odoo.
It will install the e-learning, survey and e-commerce apps and make a complete
certification flow including purchase, certification, failure and success.
""",
'depends': [
'website_sale_product_configurator',
'website_sale_slides',
'website_slides_forum',
'website_slides_survey',
'payment_demo'
],
'data': [
'data/res_groups_data.xml',
],
'demo': [
'data/product_demo.xml',
],
'installable': True,
'assets': {
'web.assets_tests': [
'test_website_slides_full/tests/tours/**/*',
],
},
'license': 'LGPL-3',
}

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo><data noupdate="1">
<record id="product_course_channel_1_option_0" model="product.product">
<field name="name">Water can</field>
<field name="standard_price">12.0</field>
<field name="list_price">12.0</field>
<field name="detailed_type">consu</field>
<field name="is_published" eval="True"/>
<field name="image_1920" type="base64" file="website_sale_slides/static/img/water_can.jpg"/>
</record>
<record id="product_course_channel_1_option_1" model="product.product">
<field name="name">Flower pot</field>
<field name="standard_price">4.5</field>
<field name="list_price">4.5</field>
<field name="detailed_type">consu</field>
<field name="is_published" eval="True"/>
<field name="image_1920" type="base64" file="website_sale_slides/static/img/flower_pot.jpg"/>
</record>
<record id="website_sale_slides.product_course_channel_1_product_template" model="product.template">
<field name="optional_product_ids" eval="[
(6, 0, [ref('test_website_slides_full.product_course_channel_1_option_0_product_template'),
ref('test_website_slides_full.product_course_channel_1_option_1_product_template')]
)]"/>
</record>
</data></odoo>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- We want to activate product variant by default for testing product
configurator. Otherwise Odoo want to de-install the whole module due
to dependency chain. -->
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[(4, ref('product.group_product_variant'))]"/>
</record>
</data>
</odoo>

View file

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_ui_wslides

View file

@ -0,0 +1,175 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil.relativedelta import relativedelta
from odoo.fields import Datetime
from odoo import tests
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.addons.website_slides.tests.test_ui_wslides import TestUICommon
@tests.common.tagged('post_install', '-at_install')
class TestUi(AccountTestInvoicingCommon, TestUICommon):
def test_course_certification_employee(self):
user_demo = self.user_demo
self.user_demo.write({
'company_id': self.env.company.id,
'company_ids': [(6, 0, self.env.company.ids)],
})
self.user_demo.sudo().partner_id.company_id = self.env.company
# Avoid Billing/Shipping address page
user_demo.write({
'groups_id': [(5, 0), (4, self.env.ref('base.group_user').id)],
'street': '215 Vine St',
'city': 'Scranton',
'zip': '18503',
'country_id': self.env.ref('base.us').id,
'state_id': self.env.ref('base.state_us_39').id,
'phone': '+1 555-555-5555',
'email': 'admin@yourcompany.example.com',
})
# Specify Accounting Data
cash_journal = self.env['account.journal'].create({'name': 'Cash - Test', 'type': 'cash', 'code': 'CASH - Test'})
self.env['payment.provider'].sudo().search([('code', '=', 'demo')]).write({
'journal_id': cash_journal.id,
'state': 'test',
'website_id': self.env.ref('website.default_website').id,
'company_id': self.env.company.id,
})
self.env.ref('website.default_website').company_id = self.env.company
a_recv = self.env['account.account'].create({
'code': 'X1012',
'name': 'Debtors - (test)',
'reconcile': True,
'account_type': 'asset_receivable',
})
a_pay = self.env['account.account'].create({
'code': 'X1111',
'name': 'Creditors - (test)',
'account_type': 'liability_payable',
'reconcile': True,
})
Property = self.env['ir.property']
Property._set_default('property_account_receivable_id', 'res.partner', a_recv, self.env.company)
Property._set_default('property_account_payable_id', 'res.partner', a_pay, self.env.company)
product_course_channel_6 = self.env['product.product'].create({
'name': 'DIY Furniture Course',
'list_price': 100.0,
'type': 'service',
'is_published': True,
})
furniture_survey = self.env['survey.survey'].create({
'title': 'Furniture Creation Certification',
'access_token': '5632a4d7-48cf-aaaa-8c52-2174d58cf50b',
'access_mode': 'public',
'questions_layout': 'one_page',
'users_can_go_back': True,
'users_login_required': True,
'scoring_type': 'scoring_with_answers',
'certification': True,
'certification_mail_template_id': self.env.ref('survey.mail_template_certification').id,
'is_attempts_limited': True,
'attempts_limit': 3,
'description': "<p>Test your furniture knowledge!</p>",
'question_and_page_ids': [
(0, 0, {
'title': 'Furniture',
'sequence': 1,
'is_page': True,
'question_type': False,
'description': "&lt;p&gt;Test your furniture knowledge!&lt;/p&gt",
}), (0, 0, {
'title': 'What type of wood is the best for furniture?',
'sequence': 2,
'question_type': 'simple_choice',
'constr_mandatory': True,
'suggested_answer_ids': [
(0, 0, {
'value': 'Fir',
'sequence': 1,
}), (0, 0, {
'value': 'Oak',
'sequence': 2,
'is_correct': True,
'answer_score': 2.0,
}), (0, 0, {
'value': 'Ash',
'sequence': 3,
}), (0, 0, {
'value': 'Beech',
'sequence': 4,
})
]
}), (0, 0, {
'title': 'Select all the furniture shown in the video',
'sequence': 3,
'question_type': 'multiple_choice',
'suggested_answer_ids': [
(0, 0, {
'value': 'Chair',
'sequence': 1,
'is_correct': True,
'answer_score': 1.0,
}), (0, 0, {
'value': 'Table',
'sequence': 2,
'answer_score': -1.0,
}), (0, 0, {
'value': 'Desk',
'sequence': 3,
'is_correct': True,
'answer_score': 1.0,
}), (0, 0, {
'value': 'Shelve',
'sequence': 4,
'is_correct': True,
'answer_score': 1.0,
}), (0, 0, {
'value': 'Bed',
'sequence': 5,
'answer_score': -1.0,
})
]
}), (0, 0, {
'title': 'What do you think about the content of the course? (not rated)',
'sequence': 4,
'question_type': 'text_box',
})
]
})
slide_channel_demo_6_furn3 = self.env['slide.channel'].create({
'name': 'DIY Furniture - TEST',
'user_id': self.env.ref('base.user_admin').id,
'enroll': 'payment',
'product_id': product_course_channel_6.id,
'channel_type': 'training',
'allow_comment': True,
'promote_strategy': 'most_voted',
'is_published': True,
'description': 'So much amazing certification.',
'create_date': Datetime.now() - relativedelta(days=2),
'slide_ids': [
(0, 0, {
'name': 'DIY Furniture Certification',
'sequence': 1,
'slide_category': 'certification',
'category_id': False,
'is_published': True,
'is_preview': False,
'description': "It's time to test your knowledge!",
'survey_id': furniture_survey.id,
})
]
})
self.browser_js(
'/slides',
'odoo.__DEBUG__.services["web_tour.tour"].run("certification_member")',
'odoo.__DEBUG__.services["web_tour.tour"].tours.certification_member.ready',
login=user_demo.login)

View file

@ -0,0 +1,176 @@
odoo.define('test_website_slides_full.tour.slide.certification.member', function (require) {
"use strict";
var tour = require('web_tour.tour');
const tourUtils = require('website_sale.tour_utils');
/**
* The purpose of this tour is to check the whole certification flow:
*
* -> student (= demo user) checks 'on payment' course content
* -> clicks on "buy course"
* -> is redirected to webshop on the product page
* -> buys the course
* -> fails 3 times, exhausting their attempts
* -> is removed to the members of the course
* -> buys the course again
* -> succeeds the certification
* -> has the course marked as completed
* -> has the certification in their user profile
*
*/
var initTourSteps = [{
content: 'eLearning: go to certification course',
trigger: 'a:contains("DIY Furniture - TEST")'
}, {
content: 'eLearning: does not have access to certification',
trigger: '.o_wslides_course_main',
run: function () {
// check that user doesn't have access to course content
if ($('.o_wslides_slides_list_slide .o_wslides_js_slides_list_slide_link').length === 0) {
$('.o_wslides_course_main').addClass('empty-content-success');
}
}
}, {
content: 'eLearning: previous step check',
trigger: '.o_wslides_course_main.empty-content-success',
run: function () {} // check that previous step succeeded
}];
var buyCertificationSteps = [{
content: 'eLearning: try to buy course',
trigger: 'a:contains("Add to Cart")'
},
tourUtils.goToCart(),
{
content: 'eCommerce: Process Checkout',
trigger: 'a:contains("Process Checkout")'
}, {
content: 'eCommerce: select Test payment provider',
trigger: '.o_payment_option_card:contains("Demo")'
}, {
content: 'eCommerce: add card number',
trigger: 'input[name="customer_input"]',
run: 'text 4242424242424242'
}, {
content: 'eCommerce: pay',
trigger: 'button[name="o_payment_submit_button"]'
}, {
content: 'eCommerce: check that the payment is successful',
trigger: '.oe_website_sale_tx_status:contains("Your payment has been successfully processed.")',
run: function () {}
}, {
content: 'eCommerce: go back to e-learning home page',
trigger: '.nav-link:contains("Courses")'
}, {
content: 'eLearning: go into bought course',
trigger: 'a:contains("DIY Furniture")'
}, {
content: 'eLearning: user should be enrolled',
trigger: '.o_wslides_js_course_join:contains("You\'re enrolled")',
run: function () {}
}, {
content: 'eLearning: start course',
trigger: '.o_wslides_js_slides_list_slide_link'
}];
var failCertificationSteps = [{
content: 'eLearning: start certification',
trigger: 'button:contains("Start Certification")'
}, { // Question: What type of wood is the best for furniture?
content: 'Survey: selecting answer "Fir"',
trigger: 'div.js_question-wrapper:contains("What type of wood is the best for furniture") label:contains("Fir")'
}, { // Question: Select all the furniture shown in the video
content: 'Survey: ticking answer "Table"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Table")'
}, {
content: 'Survey: ticking answer "Bed"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Bed")'
}, {
content: 'Survey: submitting the certification with wrong answers',
trigger: 'button:contains("Submit")'
}];
var retrySteps = [{
content: 'Survey: retry certification',
trigger: 'a:contains("Retry")'
}];
var succeedCertificationSteps = [{
content: 'eLearning: start certification',
trigger: 'button:contains("Start Certification")'
}, { // Question: What type of wood is the best for furniture?
content: 'Survey: selecting answer "Oak"',
trigger: 'div.js_question-wrapper:contains("What type of wood is the best for furniture") label:contains("Oak")',
}, { // Question: Select all the furniture shown in the video
content: 'Survey: ticking answer "Chair"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Chair")'
}, {
content: 'Survey: ticking answer "Shelve"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Shelve")'
}, {
content: 'Survey: ticking answer "Desk"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Desk")'
}, {
content: 'Survey: submitting the certification with correct answers',
trigger: 'button:contains("Submit")'
}];
var certificationCompletionSteps = [{
content: 'Survey: check certification successful',
trigger: 'div:contains("Congratulations, you have passed the test")',
run: function () {}
}, { // Sharing the certification
trigger: 'a:contains("Share your certification")'
}, {
trigger: '.oe_slide_js_share_email input',
run: 'text friend@example.com'
}, {
trigger: '.oe_slide_js_share_email button',
}, {
trigger: '.oe_slide_js_share_email .alert:not(.d-none):contains("Sharing is caring")',
run: function () {} // check email has been sent
}, {
trigger: 'button.btn-close', // close sharing modal
}, {
content: 'Survey: back to course home page',
trigger: 'a:contains("Go back to course")'
}, {
content: 'eLearning: back to e-learning home page',
trigger: '.nav-link:contains("Courses")'
}, {
content: 'eLearning: course should be completed',
trigger: '.o_wslides_course_card:contains("DIY Furniture") .rounded-pill:contains("Completed")',
run: function () {}
}];
var profileSteps = [{
content: 'eLearning: access user profile',
trigger: '.o_wslides_home_aside_loggedin a:contains("View")'
}, {
content: 'eLearning: check that the user profile certifications include the new certification',
trigger: '.o_wprofile_slides_course_card_body:contains("Furniture Creation Certification")',
run: function () {}
}];
tour.register('certification_member', {
url: '/slides',
test: true
}, [].concat(
initTourSteps,
buyCertificationSteps,
failCertificationSteps,
retrySteps,
failCertificationSteps,
retrySteps,
failCertificationSteps,
[{trigger: 'a:contains("Go back to course")'}],
buyCertificationSteps,
succeedCertificationSteps,
certificationCompletionSteps,
profileSteps
)
);
});