Initial commit: Sale packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:49 +02:00
commit 14e3d26998
6469 changed files with 2479670 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# Event CRM Sale
Add information of sale order linked to the registration for the creation of the lead.
## Installation
```bash
pip install odoo-bringout-oca-ocb-event_crm_sale
```
## Dependencies
This addon depends on:
- event_crm
- event_sale
## Manifest Information
- **Name**: Event CRM Sale
- **Version**: 1.0
- **Category**: Marketing/Events
- **License**: LGPL-3
- **Installable**: True
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `event_crm_sale`.
## 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
- 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 Event_crm_sale Module - event_crm_sale
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 event_crm_sale. 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,6 @@
# Dependencies
This addon depends on:
- [event_crm](../../odoo-bringout-oca-ocb-event_crm)
- [event_sale](../../odoo-bringout-oca-ocb-event_sale)

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Event CRM Sale',
'version': '1.0',
'category': 'Marketing/Events',
'website': 'https://www.odoo.com/app/events',
'description': "Add information of sale order linked to the registration for the creation of the lead.",
'depends': ['event_crm', 'event_sale'],
'data': [
'views/event_lead_rule_views.xml',
],
'installable': True,
'auto_install': True,
'license': 'LGPL-3',
}

View file

@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_crm_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-06 13:31+0000\n"
"PO-Revision-Date: 2024-02-06 13: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_crm_sale
#: model:ir.model,name:event_crm_sale.model_event_registration
msgid "Event Registration"
msgstr "Registracija događaja"

View file

@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_crm_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-06 13:31+0000\n"
"PO-Revision-Date: 2024-02-06 13: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_crm_sale
#: model:ir.model,name:event_crm_sale.model_event_registration
msgid "Event Registration"
msgstr ""

View file

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

View file

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import defaultdict
from odoo import models
class EventRegistration(models.Model):
_inherit = 'event.registration'
def _get_lead_grouping(self, rules, rule_to_new_regs):
""" Override to support sale-order based grouping and update.
When checking for groups for rules, we search for existing leads linked
to same group (based on sale_order_id) and rule. Each rule can therefore
update an existing lead or create a new one, for each sale order that
makes the group. """
so_registrations = self.filtered(lambda reg: reg.sale_order_id)
grouping_res = super(EventRegistration, self - so_registrations)._get_lead_grouping(rules, rule_to_new_regs)
if so_registrations:
# find existing leads in batch to put them in cache and avoid multiple search / queries
related_registrations = self.env['event.registration'].search([
('sale_order_id', 'in', so_registrations.sale_order_id.ids)
])
related_leads = self.env['crm.lead'].search([
('event_lead_rule_id', 'in', rules.ids),
('registration_ids', 'in', related_registrations.ids)
])
for rule in rules:
rule_new_regs = rule_to_new_regs[rule]
# for each group (sale_order), find its linked registrations
so_to_regs = defaultdict(lambda: self.env['event.registration'])
for registration in rule_new_regs & so_registrations:
so_to_regs[registration.sale_order_id] |= registration
# for each grouped registrations, prepare result with group and existing lead
so_res = []
for sale_order, registrations in so_to_regs.items():
registrations = registrations.sorted('id') # as an OR was used, re-ensure order
leads = related_leads.filtered(lambda lead: lead.event_lead_rule_id == rule and lead.registration_ids.sale_order_id == sale_order)
so_res.append((leads, sale_order, registrations))
if so_res:
grouping_res[rule] = grouping_res.get(rule, list()) + so_res
return grouping_res

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="event_lead_rule_view_tree" model="ir.ui.view">
<field name="name">event.lead.rule.view.tree.inherit.event.crm.sale</field>
<field name="model">event.lead.rule</field>
<field name="inherit_id" ref="event_crm.event_lead_rule_view_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lead_creation_basis']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
</field>
</record>
<record id="event_lead_rule_view_form" model="ir.ui.view">
<field name="name">event.lead.rule.view.form.inherit.event.crm.sale</field>
<field name="model">event.lead.rule</field>
<field name="inherit_id" ref="event_crm.event_lead_rule_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='lead_creation_basis']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,43 @@
[project]
name = "odoo-bringout-oca-ocb-event_crm_sale"
version = "16.0.0"
description = "Event CRM Sale - Odoo addon"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-event_crm>=16.0.0",
"odoo-bringout-oca-ocb-event_sale>=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 = ["event_crm_sale"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]