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,57 @@
# Test Full Crm Flow
This module is intended to test the main crm flows of Odoo, both frontend and
backend. It notably includes IAP bridges modules to test their impact.
## Installation
```bash
pip install odoo-bringout-oca-ocb-test_crm_full
```
## Dependencies
This addon depends on:
- crm
- crm_iap_enrich
- crm_iap_mine
- crm_sms
- event_crm
- sale_crm
- website_crm
- website_crm_iap_reveal
- website_crm_partner_assign
- website_crm_livechat
## Manifest Information
- **Name**: Test Full Crm Flow
- **Version**: 1.0
- **Category**: Hidden/Tests
- **License**: LGPL-3
- **Installable**: False
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `test_crm_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_crm_full Module - test_crm_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_crm_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,14 @@
# Dependencies
This addon depends on:
- [crm](../../odoo-bringout-oca-ocb-crm)
- [crm_iap_enrich](../../odoo-bringout-oca-ocb-crm_iap_enrich)
- [crm_iap_mine](../../odoo-bringout-oca-ocb-crm_iap_mine)
- [crm_sms](../../odoo-bringout-oca-ocb-crm_sms)
- [event_crm](../../odoo-bringout-oca-ocb-event_crm)
- [sale_crm](../../odoo-bringout-oca-ocb-sale_crm)
- [website_crm](../../odoo-bringout-oca-ocb-website_crm)
- [website_crm_iap_reveal](../../odoo-bringout-oca-ocb-website_crm_iap_reveal)
- [website_crm_partner_assign](../../odoo-bringout-oca-ocb-website_crm_partner_assign)
- [website_crm_livechat](../../odoo-bringout-oca-ocb-website_crm_livechat)

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_crm_full or install in UI.

View file

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

View file

@ -0,0 +1,11 @@
# Models
Detected core models and extensions in test_crm_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_crm_full. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon test_crm_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_crm_full
```

View file

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

View file

@ -0,0 +1,51 @@
[project]
name = "odoo-bringout-oca-ocb-test_crm_full"
version = "16.0.0"
description = "Test Full Crm Flow - Odoo addon"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-crm>=16.0.0",
"odoo-bringout-oca-ocb-crm_iap_enrich>=16.0.0",
"odoo-bringout-oca-ocb-crm_iap_mine>=16.0.0",
"odoo-bringout-oca-ocb-crm_sms>=16.0.0",
"odoo-bringout-oca-ocb-event_crm>=16.0.0",
"odoo-bringout-oca-ocb-sale_crm>=16.0.0",
"odoo-bringout-oca-ocb-website_crm>=16.0.0",
"odoo-bringout-oca-ocb-website_crm_iap_reveal>=16.0.0",
"odoo-bringout-oca-ocb-website_crm_partner_assign>=16.0.0",
"odoo-bringout-oca-ocb-website_crm_livechat>=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_crm_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,24 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Test Full Crm Flow',
'version': '1.0',
'category': 'Hidden/Tests',
'description': """
This module is intended to test the main crm flows of Odoo, both frontend and
backend. It notably includes IAP bridges modules to test their impact. """,
'depends': [
'crm',
'crm_iap_enrich',
'crm_iap_mine',
'crm_sms',
'event_crm',
'sale_crm',
'website_crm',
'website_crm_iap_reveal',
'website_crm_partner_assign',
'website_crm_livechat',
],
'license': 'LGPL-3',
}

View file

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

View file

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo.addons.crm.tests.common import TestCrmCommon
from odoo.addons.crm_iap_mine.tests.common import MockIAPReveal # MockIAPEnrich
from odoo.addons.website.tests.test_website_visitor import MockVisitor
class TestCrmFullCommon(TestCrmCommon, MockIAPReveal, MockVisitor):
@classmethod
def setUpClass(cls):
super(TestCrmFullCommon, cls).setUpClass()
cls._init_mail_gateway()
cls._activate_multi_company()
# Context data: dates
# ------------------------------------------------------------
# Mock dates to have reproducible computed fields based on time
cls.reference_now = datetime(2022, 1, 1, 10, 0, 0)
cls.reference_today = datetime(2022, 1, 1)
# Customers
# ------------------------------------------------------------
country_be = cls.env.ref('base.be')
cls.env['res.lang']._activate_lang('fr_BE')
cls.partners = cls.env['res.partner'].create([
{'country_id': country_be.id,
'email': 'partner.email.%02d@test.example.com' % idx,
'function': 'Noisy Customer',
'lang': 'fr_BE',
'mobile': '04569999%02d' % idx,
'name': 'PartnerCustomer',
'phone': '04560000%02d' % idx,
'street': 'Super Street, %092d' % idx,
'zip': '1400',
} for idx in range(0, 10)
])

View file

@ -0,0 +1,137 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from freezegun import freeze_time
from odoo.addons.test_crm_full.tests.common import TestCrmFullCommon
from odoo.tests.common import users, warmup, Form
from odoo.tests import tagged
@tagged('crm_performance', 'post_install', '-at_install', '-standard')
class CrmPerformanceCase(TestCrmFullCommon):
def setUp(self):
super(CrmPerformanceCase, self).setUp()
# patch registry to simulate a ready environment
self.patch(self.env.registry, 'ready', True)
self._flush_tracking()
self.user_sales_leads.write({
'groups_id': [
(4, self.env.ref('event.group_event_user').id),
(4, self.env.ref('im_livechat.im_livechat_group_user').id),
]
})
def _flush_tracking(self):
""" Force the creation of tracking values notably, and ensure tests are
reproducible. """
self.env.flush_all()
self.cr.flush()
@tagged('crm_performance', 'post_install', '-at_install', '-standard')
class TestCrmPerformance(CrmPerformanceCase):
@users('user_sales_leads')
@warmup
def test_lead_create_batch_mixed(self):
""" Test multiple lead creation (import) """
batch_size = 10
country_be = self.env.ref('base.be')
lang_be_id = self.env['res.lang']._lang_get_id('fr_BE')
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=194): # tcf 193 / com 194
self.env.cr._now = self.reference_now # force create_date to check schedulers
crm_values = [
{'country_id': country_be.id,
'email_from': 'address.email.%02d@test.example.com' % idx,
'function': 'Noisy Customer',
'lang_id': lang_be_id,
'mobile': '04551111%02d' % idx,
'name': 'Test Lead %02d' % idx,
'phone': '04550000%02d' % idx,
'street': 'Super Street, %092d' % idx,
'zip': '1400',
} for idx in range(batch_size)
]
crm_values += [
{'partner_id': self.partners[idx].id,
'name': 'Test Lead %02d' % idx,
} for idx in range(batch_size)
]
_leads = self.env['crm.lead'].create(crm_values)
@users('user_sales_leads')
@warmup
def test_lead_create_form_address(self):
""" Test a single lead creation using Form """
country_be = self.env.ref('base.be')
lang_be = self.env['res.lang']._lang_get('fr_BE')
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=189): # tcf only: 173 - com runbot: 174/175
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['crm.lead']) as lead_form:
lead_form.country_id = country_be
lead_form.email_from = 'address.email@test.example.com'
lead_form.function = 'Noisy Customer'
lead_form.lang_id = lang_be
lead_form.mobile = '0455111100'
lead_form.name = 'Test Lead'
lead_form.phone = '0455000011'
lead_form.street = 'Super Street, 00'
lead_form.zip = '1400'
_lead = lead_form.save()
@users('user_sales_leads')
@warmup
def test_lead_create_form_partner(self):
""" Test a single lead creation using Form with a partner """
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=199): # tcf 186 / com 188
self.env.cr._now = self.reference_now # force create_date to check schedulers
with self.debug_mode():
# {'invisible': ['|', ('type', '=', 'opportunity'), ('is_partner_visible', '=', False)]}
# lead.is_partner_visible = bool(lead.type == 'opportunity' or lead.partner_id or is_debug_mode)
with Form(self.env['crm.lead']) as lead_form:
lead_form.partner_id = self.partners[0]
lead_form.name = 'Test Lead'
_lead = lead_form.save()
@users('user_sales_leads')
@warmup
def test_lead_create_single_address(self):
""" Test multiple lead creation (import) """
country_be = self.env.ref('base.be')
lang_be_id = self.env['res.lang']._lang_get_id('fr_BE')
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=43): # tcf only: 41 - com runbot: 42
self.env.cr._now = self.reference_now # force create_date to check schedulers
crm_values = [
{'country_id': country_be.id,
'email_from': 'address.email.00@test.example.com',
'function': 'Noisy Customer',
'lang_id': lang_be_id,
'mobile': '0455111100',
'name': 'Test Lead',
'phone': '0455000000',
'street': 'Super Street, 00',
'zip': '1400',
}
]
_lead = self.env['crm.lead'].create(crm_values)
@users('user_sales_leads')
@warmup
def test_lead_create_single_partner(self):
""" Test multiple lead creation (import) """
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=49): # tcf only: 47 - com runbot: 48
self.env.cr._now = self.reference_now # force create_date to check schedulers
crm_values = [
{'partner_id': self.partners[0].id,
'name': 'Test Lead',
}
]
_lead = self.env['crm.lead'].create(crm_values)