[DOC] all: Reorganize and consolidate project documentation
- Create .github/copilot-instructions.md with global development guidelines - Add comprehensive README.md at project root with quick start guide - Create docs/ directory for technical documentation - Move installation and linter docs to docs/ - Add docs/TRANSLATIONS.md with complete translation system guide - Create README.md for OCA modified addons (product_origin, product_get_price_helper, product_main_seller) - Document translation best practices (no _() in field definitions) - Add references between all documentation files - Clean up project root by moving technical docs to docs/ All documentation now properly references addon-specific READMEs for detailed architecture and implementation.
This commit is contained in:
parent
2a480b74bb
commit
b10ba1fc15
12 changed files with 1327 additions and 0 deletions
414
.github/copilot-instructions.md
vendored
Normal file
414
.github/copilot-instructions.md
vendored
Normal file
|
|
@ -0,0 +1,414 @@
|
||||||
|
# GitHub Copilot Instructions - Kidekoop Addons Custom
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
Este repositorio contiene addons personalizados y modificados de Odoo 18.0. El proyecto combina:
|
||||||
|
|
||||||
|
- **OCB (Odoo Community Backports)**: Base de Odoo 18.0 community en `/ocb`
|
||||||
|
- **Addons OCA**: Módulos de la comunidad OCA modificados para necesidades específicas
|
||||||
|
- **Addons Custom**: Módulos desarrollados específicamente para este proyecto
|
||||||
|
|
||||||
|
## Architecture & Stack
|
||||||
|
|
||||||
|
- **Odoo Version**: 18.0
|
||||||
|
- **Python Version**: 3.10+
|
||||||
|
- **Framework**: Odoo ORM
|
||||||
|
- **Deployment**: Docker Compose
|
||||||
|
- **DB**: PostgreSQL
|
||||||
|
- **Languages**: Python, XML, JavaScript, QWeb
|
||||||
|
|
||||||
|
## Code Standards
|
||||||
|
|
||||||
|
### Python Style
|
||||||
|
|
||||||
|
- Seguir **OCA guidelines** estrictamente
|
||||||
|
- Usar **black** para formateo (configurado en `pyproject.toml`)
|
||||||
|
- **isort** para ordenar imports (perfil black)
|
||||||
|
- **flake8** para linting
|
||||||
|
- **pylint** con pylint-odoo para verificaciones específicas de Odoo
|
||||||
|
- Pre-commit hooks activos (ver `.pre-commit-config.yaml`)
|
||||||
|
|
||||||
|
### Odoo Conventions
|
||||||
|
|
||||||
|
- **Model names**: snake_case con punto (`product.price.category`)
|
||||||
|
- **Class names**: PascalCase (`ProductPriceCategory`)
|
||||||
|
- **File names**: snake_case (`product_price_category.py`)
|
||||||
|
- **XML IDs**: módulo.nombre_descriptivo (`product_price_category.view_form`)
|
||||||
|
- **Manifest**: Siempre `__manifest__.py`, nunca `__openerp__.py`
|
||||||
|
|
||||||
|
### XML/View Standards
|
||||||
|
|
||||||
|
- **Indent**: 4 espacios (no tabs)
|
||||||
|
- **XPath**: Usar `position` explícito (`before`, `after`, `inside`, `replace`, `attributes`)
|
||||||
|
- **Groups**: Referenciar grupos con módulo.xml_id (`sales_team.group_sale_manager`)
|
||||||
|
- **Sequence**: Usar `sequence` attribute para ordenar campos en vistas
|
||||||
|
|
||||||
|
### Translation System
|
||||||
|
|
||||||
|
**IMPORTANTE**: El sistema de traducciones está funcionando correctamente. Seguir estas reglas:
|
||||||
|
|
||||||
|
1. **Estructura de carpeta i18n/**:
|
||||||
|
|
||||||
|
```
|
||||||
|
addon_name/
|
||||||
|
├── i18n/
|
||||||
|
│ ├── es.po # Español (obligatorio)
|
||||||
|
│ ├── eu.po # Euskera (obligatorio)
|
||||||
|
│ └── addon_name.pot # Template (generado)
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **NO usar `_()` en definiciones de campos a nivel de módulo**:
|
||||||
|
|
||||||
|
```python
|
||||||
|
# ❌ INCORRECTO - causa warnings
|
||||||
|
from odoo import _
|
||||||
|
name = fields.Char(string=_("Name"))
|
||||||
|
|
||||||
|
# ✅ CORRECTO - traducción se maneja por .po files
|
||||||
|
name = fields.Char(string="Name")
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Usar `_()` solo en métodos y código ejecutable**:
|
||||||
|
|
||||||
|
```python
|
||||||
|
def action_confirm(self):
|
||||||
|
message = _("Confirmed successfully")
|
||||||
|
return {'warning': {'message': message}}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Generar/actualizar traducciones**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Exportar términos a traducir
|
||||||
|
docker-compose exec odoo odoo \
|
||||||
|
--addons-path=/mnt/extra-addons \
|
||||||
|
--i18n-export=/tmp/addon_name.pot \
|
||||||
|
--modules=addon_name \
|
||||||
|
--db=odoo
|
||||||
|
|
||||||
|
# Copiar y renombrar
|
||||||
|
cd addon_name/i18n
|
||||||
|
msgmerge --update es.po addon_name.pot
|
||||||
|
msgmerge --update eu.po addon_name.pot
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Formato de archivos .po**:
|
||||||
|
- Encoding: UTF-8
|
||||||
|
- Content-Type: text/plain; charset=UTF-8
|
||||||
|
- Language codes: `es`, `eu`, `ca`, `gl`, `pt`, `fr`, `it`
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
addons-cm/
|
||||||
|
├── .github/ # GitHub configs
|
||||||
|
│ └── copilot-instructions.md # Este archivo
|
||||||
|
├── ocb/ # Odoo Community Backports (18.0)
|
||||||
|
│ └── addons/ # Addons core de Odoo
|
||||||
|
├── oca_dependencies.txt # Dependencias OCA
|
||||||
|
├── requirements.txt # Dependencias Python
|
||||||
|
├── docker-compose.yml # Configuración Docker
|
||||||
|
├── Makefile # Comandos útiles
|
||||||
|
│
|
||||||
|
├── # === ADDONS OCA MODIFICADOS ===
|
||||||
|
├── account_invoice_triple_discount/ # Triple descuento en facturas (OCA)
|
||||||
|
├── purchase_triple_discount/ # Triple descuento en compras (OCA)
|
||||||
|
├── product_origin/ # Origen del producto (OCA)
|
||||||
|
├── product_get_price_helper/ # Helper de precios (OCA)
|
||||||
|
├── product_main_seller/ # Proveedor principal (OCA)
|
||||||
|
├── product_price_category/ # Categorías de precio (OCA)
|
||||||
|
│
|
||||||
|
├── # === ADDONS CUSTOM ===
|
||||||
|
├── account_invoice_triple_discount_readonly/ # Fix para triple descuento
|
||||||
|
├── product_price_category_supplier/ # Extensión categorías precio
|
||||||
|
├── product_sale_price_from_pricelist/ # Auto-cálculo precio venta
|
||||||
|
└── website_sale_aplicoop/ # Sistema eskaera (compras grupo)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Addon References
|
||||||
|
|
||||||
|
**Para arquitectura, detalles de implementación y uso específico de cada addon, consultar su `README.md` individual.**
|
||||||
|
|
||||||
|
### Addons OCA Modificados
|
||||||
|
|
||||||
|
- [account_invoice_triple_discount](../account_invoice_triple_discount/README.rst)
|
||||||
|
- [purchase_triple_discount](../purchase_triple_discount/README.rst)
|
||||||
|
- [product_origin](../product_origin/README.rst)
|
||||||
|
- [product_get_price_helper](../product_get_price_helper/README.rst)
|
||||||
|
- [product_main_seller](../product_main_seller/README.rst)
|
||||||
|
- [product_price_category](../product_price_category/README.rst)
|
||||||
|
|
||||||
|
### Addons Custom Propios
|
||||||
|
|
||||||
|
- [account_invoice_triple_discount_readonly](../account_invoice_triple_discount_readonly/README.md) - Fix bug descuentos
|
||||||
|
- [product_price_category_supplier](../product_price_category_supplier/README.md) - Gestión categorías por proveedor
|
||||||
|
- [product_sale_price_from_pricelist](../product_sale_price_from_pricelist/README.md) - Auto-precio basado en compra
|
||||||
|
- [website_sale_aplicoop](../website_sale_aplicoop/README.md) - Sistema eskaera completo
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
### Local Development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Iniciar entorno
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Actualizar addon
|
||||||
|
docker-compose exec odoo odoo -d odoo -u addon_name --stop-after-init
|
||||||
|
|
||||||
|
# Ver logs
|
||||||
|
docker-compose logs -f odoo
|
||||||
|
|
||||||
|
# Ejecutar tests
|
||||||
|
docker-compose exec odoo odoo -d odoo --test-enable --stop-after-init -u addon_name
|
||||||
|
```
|
||||||
|
|
||||||
|
### Quality Checks
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ejecutar todos los checks
|
||||||
|
pre-commit run --all-files
|
||||||
|
|
||||||
|
# O usar Makefile
|
||||||
|
make lint # Solo linting
|
||||||
|
make format # Formatear código
|
||||||
|
make check-addon # Verificar addon específico
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
- Tests en `tests/` de cada addon
|
||||||
|
- Naming: `test_*.py`
|
||||||
|
- Herencia: `odoo.tests.common.TransactionCase`
|
||||||
|
- Ejecutar: `--test-enable` flag
|
||||||
|
|
||||||
|
## Common Patterns
|
||||||
|
|
||||||
|
### Extending Models
|
||||||
|
|
||||||
|
```python
|
||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
class ResPartner(models.Model):
|
||||||
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
custom_field = fields.Char(string="Custom Field")
|
||||||
|
|
||||||
|
@api.depends('field1', 'field2')
|
||||||
|
def _compute_custom(self):
|
||||||
|
for record in self:
|
||||||
|
record.custom_computed = record.field1 + record.field2
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating Wizards (Transient Models)
|
||||||
|
|
||||||
|
```python
|
||||||
|
class WizardModel(models.TransientModel):
|
||||||
|
_name = 'wizard.model.name'
|
||||||
|
_description = "Wizard Description"
|
||||||
|
|
||||||
|
def action_confirm(self):
|
||||||
|
# Business logic
|
||||||
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Bulk Updates
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Prefer SQL-level updates for performance
|
||||||
|
self.env['product.template'].search([
|
||||||
|
('default_supplier_id', '=', partner_id)
|
||||||
|
]).write({'price_category_id': category_id})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Notifications
|
||||||
|
|
||||||
|
```python
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.client',
|
||||||
|
'tag': 'display_notification',
|
||||||
|
'params': {
|
||||||
|
'title': _('Success'),
|
||||||
|
'message': _('Operation completed'),
|
||||||
|
'type': 'success', # or 'warning', 'danger', 'info'
|
||||||
|
'sticky': False,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies Management
|
||||||
|
|
||||||
|
### OCA Dependencies (`oca_dependencies.txt`)
|
||||||
|
|
||||||
|
```
|
||||||
|
account-invoicing
|
||||||
|
product-attribute
|
||||||
|
purchase-workflow
|
||||||
|
sale-workflow
|
||||||
|
```
|
||||||
|
|
||||||
|
### Python Dependencies (`requirements.txt`)
|
||||||
|
|
||||||
|
- Versiones específicas para evitar breaking changes
|
||||||
|
- Incluir herramientas de desarrollo (linters, etc)
|
||||||
|
|
||||||
|
## Security & Access Rights
|
||||||
|
|
||||||
|
### Grupos Comunes
|
||||||
|
|
||||||
|
- `base.group_user` - Usuario interno
|
||||||
|
- `base.group_system` - Administrador
|
||||||
|
- `sales_team.group_sale_manager` - Manager de ventas
|
||||||
|
- `sales_team.group_sale_salesman` - Vendedor
|
||||||
|
- `purchase.group_purchase_manager` - Manager de compras
|
||||||
|
|
||||||
|
### Security Files
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- security/ir.model.access.csv -->
|
||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_model_user,model.name.user,model_model_name,base.group_user,1,1,1,0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Issues & Solutions
|
||||||
|
|
||||||
|
### Translation Warnings
|
||||||
|
|
||||||
|
**Problem**: `WARNING: _() called at import time at module...`
|
||||||
|
**Solution**: Remove `_()` from field definitions, use only in methods
|
||||||
|
|
||||||
|
### XPath Not Found
|
||||||
|
|
||||||
|
**Problem**: `Element ... not found in parent view`
|
||||||
|
**Solution**: Check view inheritance chain, verify XML IDs are correct
|
||||||
|
|
||||||
|
### Discount Reset Issue
|
||||||
|
|
||||||
|
**Problem**: Multiple discounts being accumulated in discount1
|
||||||
|
**Solution**: Use `account_invoice_triple_discount_readonly` addon
|
||||||
|
|
||||||
|
### Price Calculation
|
||||||
|
|
||||||
|
**Problem**: Prices not updating from pricelist
|
||||||
|
**Solution**: Use `product_sale_price_from_pricelist` with proper configuration
|
||||||
|
|
||||||
|
## Testing Guidelines
|
||||||
|
|
||||||
|
### Unit Tests
|
||||||
|
|
||||||
|
- Test business logic in isolation
|
||||||
|
- Mock external dependencies
|
||||||
|
- Use `TransactionCase` for DB tests
|
||||||
|
|
||||||
|
### Integration Tests
|
||||||
|
|
||||||
|
- Test workflow end-to-end
|
||||||
|
- Verify computed fields
|
||||||
|
- Check access rights
|
||||||
|
|
||||||
|
### UI Tests (Tours)
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
odoo.define("module.tour", function (require) {
|
||||||
|
"use strict";
|
||||||
|
var tour = require("web_tour.tour");
|
||||||
|
tour.register(
|
||||||
|
"tour_name",
|
||||||
|
{
|
||||||
|
test: true,
|
||||||
|
url: "/web",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
// Tour steps
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Debugging Tips
|
||||||
|
|
||||||
|
### Enable Developer Mode
|
||||||
|
|
||||||
|
```
|
||||||
|
Settings > Activate Developer Mode
|
||||||
|
```
|
||||||
|
|
||||||
|
### Check Logs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs -f odoo | grep ERROR
|
||||||
|
docker-compose logs -f odoo | grep addon_name
|
||||||
|
```
|
||||||
|
|
||||||
|
### Python Debugger
|
||||||
|
|
||||||
|
```python
|
||||||
|
import pdb; pdb.set_trace() # Set breakpoint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance Profiling
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--log-level=debug_sql # Show SQL queries
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation Standards
|
||||||
|
|
||||||
|
### README.md Structure
|
||||||
|
|
||||||
|
Cada addon debe tener un README.md con:
|
||||||
|
|
||||||
|
1. **Title & Summary**: Qué hace el addon
|
||||||
|
2. **Features**: Lista de funcionalidades
|
||||||
|
3. **Dependencies**: Addons requeridos
|
||||||
|
4. **Installation**: Comandos de instalación
|
||||||
|
5. **Configuration**: Settings necesarios
|
||||||
|
6. **Usage**: Flujo de trabajo típico
|
||||||
|
7. **Technical Details**: Modelos, campos, métodos
|
||||||
|
8. **Translations**: Estado de traducciones (si aplica)
|
||||||
|
|
||||||
|
### Code Comments
|
||||||
|
|
||||||
|
- Docstrings en clases y métodos públicos
|
||||||
|
- Comentarios inline para lógica compleja
|
||||||
|
- TODOs con contexto completo
|
||||||
|
|
||||||
|
## Version Control
|
||||||
|
|
||||||
|
### Commit Messages
|
||||||
|
|
||||||
|
```
|
||||||
|
[TAG] module: Brief description
|
||||||
|
|
||||||
|
Longer explanation if needed
|
||||||
|
```
|
||||||
|
|
||||||
|
Tags: `[ADD]`, `[FIX]`, `[IMP]`, `[REF]`, `[REM]`, `[I18N]`, `[DOC]`
|
||||||
|
|
||||||
|
### Branch Strategy
|
||||||
|
|
||||||
|
- `main` - Production ready
|
||||||
|
- `dev` - Development
|
||||||
|
- `feature/*` - New features
|
||||||
|
- `fix/*` - Bug fixes
|
||||||
|
|
||||||
|
## Performance Considerations
|
||||||
|
|
||||||
|
- Use `@api.depends` correctamente para computed fields
|
||||||
|
- Prefer `search()` + `write()` sobre loops con `write()`
|
||||||
|
- Use `create()` con lista de vals para bulk creates
|
||||||
|
- Indexes en campos frecuentemente buscados
|
||||||
|
- Avoid N+1 queries con `prefetch`
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- **OCA Guidelines**: https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst
|
||||||
|
- **Odoo Documentation**: https://www.odoo.com/documentation/18.0/
|
||||||
|
- **OCB Repository**: https://github.com/OCA/OCB
|
||||||
|
- **OCA Repositories**: https://github.com/OCA/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Last Updated**: 2026-02-12
|
||||||
|
**Odoo Version**: 18.0
|
||||||
|
**Python Version**: 3.10+
|
||||||
249
README.md
Normal file
249
README.md
Normal file
|
|
@ -0,0 +1,249 @@
|
||||||
|
# Kidekoop - Addons Custom para Odoo 18.0
|
||||||
|
|
||||||
|
Sistema de gestión de compras colaborativas (grupo de consumo) basado en Odoo 18.0 con módulos personalizados y modificados.
|
||||||
|
|
||||||
|
## 🎯 Descripción
|
||||||
|
|
||||||
|
Este repositorio contiene los addons personalizados para Kidekoop, un sistema completo de gestión de grupos de consumo que permite:
|
||||||
|
|
||||||
|
- **Gestión de compras colaborativas** (eskaera)
|
||||||
|
- **Sistema de precios multinivel** con categorías y descuentos múltiples
|
||||||
|
- **Integración con proveedores** y gestión de precios automática
|
||||||
|
- **Interfaz web moderna** para pedidos grupales
|
||||||
|
- **Multiidioma** (ES, EU, CA, GL, PT, FR, IT)
|
||||||
|
|
||||||
|
## 📦 Componentes del Proyecto
|
||||||
|
|
||||||
|
### 1. OCB - Odoo Community Backports
|
||||||
|
- **Ubicación**: `/ocb`
|
||||||
|
- **Versión**: 18.0
|
||||||
|
- **Descripción**: Base de Odoo Community Edition
|
||||||
|
- **Repositorio**: https://github.com/OCA/OCB
|
||||||
|
|
||||||
|
### 2. Addons OCA Modificados
|
||||||
|
|
||||||
|
| Addon | Propósito | Repositorio OCA |
|
||||||
|
|-------|-----------|-----------------|
|
||||||
|
| [account_invoice_triple_discount](account_invoice_triple_discount/) | Sistema de triple descuento en facturas | account-invoicing |
|
||||||
|
| [purchase_triple_discount](purchase_triple_discount/) | Sistema de triple descuento en compras | purchase-workflow |
|
||||||
|
| [product_origin](product_origin/) | Campo de origen del producto | product-attribute |
|
||||||
|
| [product_get_price_helper](product_get_price_helper/) | Helper para cálculo de precios | product-attribute |
|
||||||
|
| [product_main_seller](product_main_seller/) | Proveedor principal por producto | purchase-workflow |
|
||||||
|
| [product_price_category](product_price_category/) | Sistema de categorías de precio | product-attribute |
|
||||||
|
|
||||||
|
### 3. Addons Custom Propios
|
||||||
|
|
||||||
|
| Addon | Propósito | Estado |
|
||||||
|
|-------|-----------|--------|
|
||||||
|
| [account_invoice_triple_discount_readonly](account_invoice_triple_discount_readonly/) | Fix para bug de descuentos acumulados | ✅ Estable |
|
||||||
|
| [product_price_category_supplier](product_price_category_supplier/) | Gestión de categorías por proveedor | ✅ Estable |
|
||||||
|
| [product_sale_price_from_pricelist](product_sale_price_from_pricelist/) | Auto-cálculo precio venta desde compra | ✅ Estable |
|
||||||
|
| [website_sale_aplicoop](website_sale_aplicoop/) | Sistema completo de eskaera web | ✅ Estable |
|
||||||
|
|
||||||
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
### Requisitos
|
||||||
|
|
||||||
|
- Docker & Docker Compose
|
||||||
|
- Python 3.10+
|
||||||
|
- PostgreSQL 14+
|
||||||
|
|
||||||
|
### Instalación
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clonar repositorio
|
||||||
|
git clone [URL_REPO]
|
||||||
|
cd addons-cm
|
||||||
|
|
||||||
|
# Iniciar entorno
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Verificar logs
|
||||||
|
docker-compose logs -f odoo
|
||||||
|
```
|
||||||
|
|
||||||
|
### Instalar un addon
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose exec odoo odoo -d odoo -u addon_name --stop-after-init
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🛠️ Desarrollo
|
||||||
|
|
||||||
|
### Estructura de Carpetas
|
||||||
|
|
||||||
|
```
|
||||||
|
addons-cm/
|
||||||
|
├── .github/ # GitHub Copilot instructions
|
||||||
|
├── ocb/ # Odoo 18.0 base
|
||||||
|
├── account_invoice_*/ # Addons de facturación
|
||||||
|
├── purchase_*/ # Addons de compras
|
||||||
|
├── product_*/ # Addons de productos
|
||||||
|
├── website_sale_aplicoop/ # Sistema eskaera
|
||||||
|
├── docker-compose.yml # Configuración Docker
|
||||||
|
├── requirements.txt # Dependencias Python
|
||||||
|
├── oca_dependencies.txt # Dependencias OCA
|
||||||
|
├── Makefile # Comandos útiles
|
||||||
|
└── .pre-commit-config.yaml # Hooks de pre-commit
|
||||||
|
```
|
||||||
|
|
||||||
|
### Herramientas de Calidad
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ejecutar checks de código
|
||||||
|
make lint
|
||||||
|
|
||||||
|
# Formatear código
|
||||||
|
make format
|
||||||
|
|
||||||
|
# Ejecutar todos los pre-commit hooks
|
||||||
|
pre-commit run --all-files
|
||||||
|
|
||||||
|
# Verificar addon específico
|
||||||
|
./check_addon.sh addon_name
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ejecutar tests de un addon
|
||||||
|
docker-compose exec odoo odoo -d odoo --test-enable --stop-after-init -u addon_name
|
||||||
|
|
||||||
|
# Tests específicos con Python unittest
|
||||||
|
docker-compose exec odoo python -m pytest addons/addon_name/tests/
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🌍 Sistema de Traducciones
|
||||||
|
|
||||||
|
Todos los addons custom incluyen traducciones completas en:
|
||||||
|
|
||||||
|
- **Español** (es) - Obligatorio
|
||||||
|
- **Euskera** (eu) - Obligatorio
|
||||||
|
- **Catalán** (ca)
|
||||||
|
- **Gallego** (gl)
|
||||||
|
- **Portugués** (pt)
|
||||||
|
- **Francés** (fr)
|
||||||
|
- **Italiano** (it)
|
||||||
|
|
||||||
|
### Actualizar Traducciones
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Exportar términos traducibles
|
||||||
|
docker-compose exec odoo odoo \
|
||||||
|
--addons-path=/mnt/extra-addons \
|
||||||
|
--i18n-export=/tmp/addon_name.pot \
|
||||||
|
--modules=addon_name \
|
||||||
|
--db=odoo
|
||||||
|
|
||||||
|
# Actualizar archivos .po
|
||||||
|
cd addon_name/i18n
|
||||||
|
msgmerge --update es.po addon_name.pot
|
||||||
|
msgmerge --update eu.po addon_name.pot
|
||||||
|
```
|
||||||
|
|
||||||
|
**Importante**: No usar `_()` en definiciones de campos a nivel de módulo. Solo usar en métodos.
|
||||||
|
|
||||||
|
📖 **[Ver guía completa de traducciones](docs/TRANSLATIONS.md)**
|
||||||
|
|
||||||
|
## 📖 Documentación Adicional
|
||||||
|
|
||||||
|
Cada addon incluye su propio README.md con:
|
||||||
|
- Arquitectura y diseño
|
||||||
|
- Detalles de implementación
|
||||||
|
- Ejemplos de uso
|
||||||
|
- Casos de prueba
|
||||||
|
|
||||||
|
### Documentos Principales
|
||||||
|
|
||||||
|
- [GitHub Copilot Instructions](.github/copilot-instructions.md) - Guía para desarrollo con AI
|
||||||
|
- [Documentación Técnica](docs/) - Guías de instalación, linters, y troubleshooting
|
||||||
|
- [Makefile](Makefile) - Comandos disponibles
|
||||||
|
- [requirements.txt](requirements.txt) - Dependencias Python
|
||||||
|
- [oca_dependencies.txt](oca_dependencies.txt) - Repositorios OCA necesarios
|
||||||
|
|
||||||
|
## 🔧 Configuración
|
||||||
|
|
||||||
|
### Dependencias OCA
|
||||||
|
|
||||||
|
Este proyecto depende de los siguientes repositorios OCA:
|
||||||
|
|
||||||
|
- **account-invoicing**: Sistema de facturación extendido
|
||||||
|
- **product-attribute**: Gestión avanzada de productos
|
||||||
|
- **purchase-workflow**: Flujos de compra personalizados
|
||||||
|
- **sale-workflow**: Flujos de venta personalizados
|
||||||
|
|
||||||
|
### Configuración de Odoo
|
||||||
|
|
||||||
|
Archivo `odoo.conf` incluye:
|
||||||
|
- Configuración de addons path
|
||||||
|
- Parámetros de base de datos
|
||||||
|
- Configuración de workers y límites
|
||||||
|
|
||||||
|
## 🐛 Issues Conocidos y Soluciones
|
||||||
|
|
||||||
|
### Descuentos Acumulándose en discount1
|
||||||
|
|
||||||
|
**Problema**: Al usar triple descuento, todos los descuentos se acumulan en el primer campo.
|
||||||
|
|
||||||
|
**Solución**: Instalar `account_invoice_triple_discount_readonly`
|
||||||
|
|
||||||
|
### Precio de Venta No Actualiza
|
||||||
|
|
||||||
|
**Problema**: El precio de venta no se calcula automáticamente desde el precio de compra.
|
||||||
|
|
||||||
|
**Solución**: Configurar `product_sale_price_from_pricelist` correctamente.
|
||||||
|
|
||||||
|
### Warnings de Traducción
|
||||||
|
|
||||||
|
**Problema**: `WARNING: _() called at import time at module...`
|
||||||
|
|
||||||
|
**Solución**: No usar `_()` en definiciones de campos, solo en métodos ejecutables.
|
||||||
|
|
||||||
|
## 🤝 Contribuir
|
||||||
|
|
||||||
|
### Estándares de Código
|
||||||
|
|
||||||
|
- Seguir [OCA Guidelines](https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst)
|
||||||
|
- Usar **black** para formateo
|
||||||
|
- Usar **isort** para imports
|
||||||
|
- Pasar **flake8** y **pylint-odoo**
|
||||||
|
- Todos los commits deben pasar pre-commit hooks
|
||||||
|
|
||||||
|
### Estructura de Commits
|
||||||
|
|
||||||
|
```
|
||||||
|
[TAG] module_name: Brief description
|
||||||
|
|
||||||
|
Detailed explanation if needed
|
||||||
|
|
||||||
|
Tags: [ADD], [FIX], [IMP], [REF], [REM], [I18N], [DOC]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Todos los nuevos features deben incluir:
|
||||||
|
- Tests unitarios
|
||||||
|
- Tests de integración (si aplica)
|
||||||
|
- Documentación actualizada
|
||||||
|
|
||||||
|
## 📝 License
|
||||||
|
|
||||||
|
AGPL-3.0 or later
|
||||||
|
|
||||||
|
## 👥 Autores
|
||||||
|
|
||||||
|
- **Criptomart** - Development
|
||||||
|
- **OCA Community** - Base addons
|
||||||
|
|
||||||
|
## 🔗 Enlaces
|
||||||
|
|
||||||
|
- **Odoo Documentation**: https://www.odoo.com/documentation/18.0/
|
||||||
|
- **OCA**: https://github.com/OCA
|
||||||
|
- **OCB**: https://github.com/OCA/OCB
|
||||||
|
- **OCA Guidelines**: https://github.com/OCA/odoo-community.org
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Versión Odoo**: 18.0
|
||||||
|
**Python**: 3.10+
|
||||||
|
**Última Actualización**: 2026-02-12
|
||||||
42
docs/README.md
Normal file
42
docs/README.md
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# Documentación Técnica
|
||||||
|
|
||||||
|
Esta carpeta contiene documentación técnica y de referencia del proyecto.
|
||||||
|
|
||||||
|
## Contenido
|
||||||
|
|
||||||
|
### Configuración y Desarrollo
|
||||||
|
|
||||||
|
- **[LINTERS_README.md](LINTERS_README.md)** - Guía de herramientas de calidad de código (black, isort, flake8, pylint)
|
||||||
|
- **[TRANSLATIONS.md](TRANSLATIONS.md)** - Guía completa del sistema de traducciones (IMPORTANTE)
|
||||||
|
- **[INSTALACION_COMPLETA.md](INSTALACION_COMPLETA.md)** - Documentación detallada del proceso de instalación
|
||||||
|
- **[RESUMEN_INSTALACION.md](RESUMEN_INSTALACION.md)** - Resumen ejecutivo de la instalación
|
||||||
|
|
||||||
|
### Resolución de Problemas
|
||||||
|
|
||||||
|
- **[CORRECCION_PRECIOS_IVA.md](CORRECCION_PRECIOS_IVA.md)** - Correcciones relacionadas con precios e IVA
|
||||||
|
- **[TEST_MANUAL.md](TEST_MANUAL.md)** - Guía de tests manuales
|
||||||
|
|
||||||
|
## Documentación Principal
|
||||||
|
|
||||||
|
Para información general del proyecto y cómo empezar, ver:
|
||||||
|
|
||||||
|
- **[README.md](../README.md)** - Documentación principal del repositorio
|
||||||
|
- **[.github/copilot-instructions.md](../.github/copilot-instructions.md)** - Instrucciones para GitHub Copilot
|
||||||
|
|
||||||
|
## Documentación por Addon
|
||||||
|
|
||||||
|
Cada addon tiene su propio README:
|
||||||
|
|
||||||
|
### Addons Custom
|
||||||
|
- [account_invoice_triple_discount_readonly](../account_invoice_triple_discount_readonly/README.md)
|
||||||
|
- [product_price_category_supplier](../product_price_category_supplier/README.md)
|
||||||
|
- [product_sale_price_from_pricelist](../product_sale_price_from_pricelist/README.md)
|
||||||
|
- [website_sale_aplicoop](../website_sale_aplicoop/README.md)
|
||||||
|
|
||||||
|
### Addons OCA Modificados
|
||||||
|
- [account_invoice_triple_discount](../account_invoice_triple_discount/README.rst)
|
||||||
|
- [purchase_triple_discount](../purchase_triple_discount/README.rst)
|
||||||
|
- [product_origin](../product_origin/README.md)
|
||||||
|
- [product_get_price_helper](../product_get_price_helper/README.md)
|
||||||
|
- [product_main_seller](../product_main_seller/README.md)
|
||||||
|
- [product_price_category](../product_price_category/README.rst)
|
||||||
314
docs/TRANSLATIONS.md
Normal file
314
docs/TRANSLATIONS.md
Normal file
|
|
@ -0,0 +1,314 @@
|
||||||
|
# Sistema de Traducciones - Guía Completa
|
||||||
|
|
||||||
|
## Estado Actual
|
||||||
|
|
||||||
|
✅ **El sistema de traducciones está funcionando correctamente**
|
||||||
|
|
||||||
|
Todos los addons custom incluyen traducciones para:
|
||||||
|
- **Español (es)** - Obligatorio
|
||||||
|
- **Euskera (eu)** - Obligatorio
|
||||||
|
- Catalán (ca), Gallego (gl), Portugués (pt), Francés (fr), Italiano (it) - Opcional
|
||||||
|
|
||||||
|
## Estructura de Archivos
|
||||||
|
|
||||||
|
Cada addon debe tener la siguiente estructura:
|
||||||
|
|
||||||
|
```
|
||||||
|
addon_name/
|
||||||
|
├── i18n/
|
||||||
|
│ ├── es.po # Español (obligatorio)
|
||||||
|
│ ├── eu.po # Euskera (obligatorio)
|
||||||
|
│ ├── ca.po # Catalán (opcional)
|
||||||
|
│ ├── gl.po # Gallego (opcional)
|
||||||
|
│ ├── pt.po # Portugués (opcional)
|
||||||
|
│ ├── fr.po # Francés (opcional)
|
||||||
|
│ ├── it.po # Italiano (opcional)
|
||||||
|
│ └── addon_name.pot # Template (generado automáticamente)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reglas Importantes
|
||||||
|
|
||||||
|
### ❌ NO Hacer
|
||||||
|
|
||||||
|
**NUNCA usar `_()` en definiciones de campos a nivel de módulo:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
# ❌ INCORRECTO - Causa warnings
|
||||||
|
from odoo import _
|
||||||
|
|
||||||
|
class MyModel(models.Model):
|
||||||
|
_name = 'my.model'
|
||||||
|
|
||||||
|
name = fields.Char(string=_("Name")) # ❌ MAL
|
||||||
|
description = fields.Text(string=_("Description")) # ❌ MAL
|
||||||
|
```
|
||||||
|
|
||||||
|
**Por qué está mal**: `_()` se ejecuta en tiempo de importación del módulo, antes de que el sistema de traducciones esté inicializado, causando warnings.
|
||||||
|
|
||||||
|
### ✅ Hacer
|
||||||
|
|
||||||
|
**Usar strings literales en definiciones de campos:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
# ✅ CORRECTO
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
class MyModel(models.Model):
|
||||||
|
_name = 'my.model'
|
||||||
|
|
||||||
|
name = fields.Char(string="Name") # ✅ BIEN
|
||||||
|
description = fields.Text(string="Description") # ✅ BIEN
|
||||||
|
```
|
||||||
|
|
||||||
|
**Usar `_()` solo en métodos y código ejecutable:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
# ✅ CORRECTO
|
||||||
|
from odoo import _, models
|
||||||
|
|
||||||
|
class MyModel(models.Model):
|
||||||
|
_name = 'my.model'
|
||||||
|
|
||||||
|
def action_confirm(self):
|
||||||
|
message = _("Order confirmed successfully") # ✅ BIEN
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.client',
|
||||||
|
'tag': 'display_notification',
|
||||||
|
'params': {
|
||||||
|
'title': _('Success'), # ✅ BIEN
|
||||||
|
'message': message,
|
||||||
|
'type': 'success',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _compute_display_name(self):
|
||||||
|
for record in self:
|
||||||
|
record.display_name = _("Order %s") % record.name # ✅ BIEN
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cómo Generar/Actualizar Traducciones
|
||||||
|
|
||||||
|
### 1. Exportar Términos Traducibles
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Exportar términos del addon
|
||||||
|
docker-compose exec odoo odoo \
|
||||||
|
--addons-path=/mnt/extra-addons \
|
||||||
|
--i18n-export=/tmp/addon_name.pot \
|
||||||
|
--modules=addon_name \
|
||||||
|
--db=odoo \
|
||||||
|
--stop-after-init
|
||||||
|
|
||||||
|
# Copiar el archivo generado
|
||||||
|
docker-compose cp odoo:/tmp/addon_name.pot ./addon_name/i18n/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Actualizar Archivos .po Existentes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd addon_name/i18n
|
||||||
|
|
||||||
|
# Actualizar español
|
||||||
|
msgmerge --update es.po addon_name.pot
|
||||||
|
|
||||||
|
# Actualizar euskera
|
||||||
|
msgmerge --update eu.po addon_name.pot
|
||||||
|
|
||||||
|
# Actualizar otros idiomas (si existen)
|
||||||
|
msgmerge --update ca.po addon_name.pot
|
||||||
|
msgmerge --update gl.po addon_name.pot
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Traducir Términos Nuevos
|
||||||
|
|
||||||
|
Editar los archivos `.po` y completar las traducciones:
|
||||||
|
|
||||||
|
```po
|
||||||
|
#: models/my_model.py:25
|
||||||
|
msgid "Order confirmed successfully"
|
||||||
|
msgstr "Pedido confirmado correctamente" # Español
|
||||||
|
|
||||||
|
#: models/my_model.py:30
|
||||||
|
msgid "Success"
|
||||||
|
msgstr "Éxito"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Cargar Traducciones en Odoo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Actualizar addon con nuevas traducciones
|
||||||
|
docker-compose exec odoo odoo -d odoo -u addon_name --stop-after-init
|
||||||
|
|
||||||
|
# O reiniciar Odoo para que cargue los cambios
|
||||||
|
docker-compose restart odoo
|
||||||
|
```
|
||||||
|
|
||||||
|
## Formato de Archivos .po
|
||||||
|
|
||||||
|
### Cabecera Requerida
|
||||||
|
|
||||||
|
```po
|
||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * addon_name
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 18.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2026-02-12 10:00+0000\n"
|
||||||
|
"PO-Revision-Date: 2026-02-12 10:00+0000\n"
|
||||||
|
"Last-Translator: Your Name <your.email@example.com>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: es\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Campos Traducibles
|
||||||
|
|
||||||
|
Odoo automáticamente detecta y exporta:
|
||||||
|
|
||||||
|
1. **String en definiciones de campos**: `fields.Char(string="Name")`
|
||||||
|
2. **Help text**: `fields.Char(help="Enter the product name")`
|
||||||
|
3. **Selection options**: `fields.Selection([('draft', 'Draft'), ('done', 'Done')])`
|
||||||
|
4. **Texto en vistas XML**: `<label string="Customer Name"/>`
|
||||||
|
5. **Botones en vistas**: `<button string="Confirm"/>`
|
||||||
|
6. **Mensajes en código**: `_("Message text")`
|
||||||
|
7. **Excepciones**: `raise ValidationError(_("Invalid value"))`
|
||||||
|
|
||||||
|
## Verificación
|
||||||
|
|
||||||
|
### Comprobar que las Traducciones Funcionan
|
||||||
|
|
||||||
|
1. **Activar el idioma en Odoo**:
|
||||||
|
- Settings > Translations > Load a Translation
|
||||||
|
- Seleccionar el idioma (ej: Español)
|
||||||
|
|
||||||
|
2. **Cambiar idioma de usuario**:
|
||||||
|
- Settings > Users > [Usuario]
|
||||||
|
- Language: Español
|
||||||
|
|
||||||
|
3. **Verificar en la interfaz**:
|
||||||
|
- Abrir el módulo
|
||||||
|
- Verificar que los textos aparecen traducidos
|
||||||
|
|
||||||
|
### Logs de Carga
|
||||||
|
|
||||||
|
Al actualizar el módulo, verificar en logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs odoo | grep "loading translation"
|
||||||
|
```
|
||||||
|
|
||||||
|
Debe mostrar:
|
||||||
|
|
||||||
|
```
|
||||||
|
odoo.modules.loading: loading translation file for language 'es': addon_name/i18n/es.po
|
||||||
|
odoo.modules.loading: loading translation file for language 'eu': addon_name/i18n/eu.po
|
||||||
|
```
|
||||||
|
|
||||||
|
## Addons con Traducciones Completas
|
||||||
|
|
||||||
|
### Addons Custom
|
||||||
|
|
||||||
|
| Addon | es | eu | Otros |
|
||||||
|
|-------|----|----|-------|
|
||||||
|
| account_invoice_triple_discount_readonly | ✅ | ✅ | - |
|
||||||
|
| product_price_category_supplier | ✅ | ✅ | - |
|
||||||
|
| product_sale_price_from_pricelist | ✅ | - | - |
|
||||||
|
| website_sale_aplicoop | ✅ | ✅ | ca, gl, pt, fr, it |
|
||||||
|
|
||||||
|
### Addons OCA
|
||||||
|
|
||||||
|
Los addons OCA ya incluyen traducciones en múltiples idiomas.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Warning: "_() called at import time"
|
||||||
|
|
||||||
|
**Síntoma**:
|
||||||
|
```
|
||||||
|
WARNING: _() called at import time at module.path:line
|
||||||
|
```
|
||||||
|
|
||||||
|
**Causa**: `_()` usado en definición de campo a nivel de módulo
|
||||||
|
|
||||||
|
**Solución**: Eliminar `_()` de la definición del campo:
|
||||||
|
```python
|
||||||
|
# Cambiar:
|
||||||
|
name = fields.Char(string=_("Name"))
|
||||||
|
# Por:
|
||||||
|
name = fields.Char(string="Name")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Traducciones No Aparecen
|
||||||
|
|
||||||
|
**Posibles causas**:
|
||||||
|
|
||||||
|
1. **Archivo .po mal formado**: Verificar encoding UTF-8
|
||||||
|
2. **Módulo no actualizado**: `docker-compose exec odoo odoo -d odoo -u addon_name --stop-after-init`
|
||||||
|
3. **Idioma no activado**: Settings > Translations > Load Translation
|
||||||
|
4. **Usuario con idioma incorrecto**: Verificar preferencias de usuario
|
||||||
|
5. **Cache**: Reiniciar Odoo: `docker-compose restart odoo`
|
||||||
|
|
||||||
|
### Caracteres Especiales
|
||||||
|
|
||||||
|
Usar escape correcto en .po:
|
||||||
|
|
||||||
|
```po
|
||||||
|
# Comillas
|
||||||
|
msgstr "Haga clic en \"Confirmar\""
|
||||||
|
|
||||||
|
# Saltos de línea
|
||||||
|
msgstr "Primera línea\n"
|
||||||
|
"Segunda línea"
|
||||||
|
|
||||||
|
# Caracteres especiales (á, é, í, ó, ú, ñ, ç)
|
||||||
|
# Usar directamente, el archivo debe ser UTF-8
|
||||||
|
msgstr "Configuración"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Herramientas Útiles
|
||||||
|
|
||||||
|
### Editores de .po
|
||||||
|
|
||||||
|
- **Poedit**: https://poedit.net/ (GUI, recomendado)
|
||||||
|
- **VS Code**: Con extensión "gettext" para syntax highlighting
|
||||||
|
- **Lokalize**: Editor KDE para traducciones
|
||||||
|
|
||||||
|
### Comandos Útiles
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar formato de archivo .po
|
||||||
|
msgfmt -c -v -o /dev/null addon_name/i18n/es.po
|
||||||
|
|
||||||
|
# Estadísticas de traducción
|
||||||
|
msgfmt --statistics addon_name/i18n/es.po
|
||||||
|
|
||||||
|
# Extraer solo términos sin traducir
|
||||||
|
msgattrib --untranslated addon_name/i18n/es.po
|
||||||
|
```
|
||||||
|
|
||||||
|
## Mejores Prácticas
|
||||||
|
|
||||||
|
1. ✅ Mantener es.po y eu.po siempre actualizados
|
||||||
|
2. ✅ Usar términos consistentes en todo el proyecto
|
||||||
|
3. ✅ Incluir contexto en comentarios cuando sea necesario
|
||||||
|
4. ✅ Verificar traducciones antes de commit
|
||||||
|
5. ✅ Nunca usar `_()` en definiciones de campos
|
||||||
|
6. ✅ Usar encoding UTF-8 en todos los archivos .po
|
||||||
|
7. ✅ Generar .pot después de cambios importantes
|
||||||
|
8. ✅ Documentar términos técnicos específicos del dominio
|
||||||
|
|
||||||
|
## Referencias
|
||||||
|
|
||||||
|
- **Odoo Translation Guidelines**: https://www.odoo.com/documentation/18.0/developer/reference/frontend/translations.html
|
||||||
|
- **GNU gettext Manual**: https://www.gnu.org/software/gettext/manual/
|
||||||
|
- **OCA Translation Guidelines**: https://github.com/OCA/maintainer-tools/wiki/Translations
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Última Actualización**: 2026-02-12
|
||||||
124
product_get_price_helper/README.md
Normal file
124
product_get_price_helper/README.md
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
# Product Get Price Helper
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Provides a helper utility function to compute product prices with taxes, discounts, and unit of measure conversions.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Price Calculation Utility**: Helper method `get_product_price_for_pricelist`
|
||||||
|
- **Tax Handling**: Automatically computes prices with or without taxes
|
||||||
|
- **Discount Support**: Handles single and multiple discounts
|
||||||
|
- **UoM Conversion**: Converts prices between different units of measure
|
||||||
|
- **Reusable**: Can be used by other modules for price calculations
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
### Utility Function
|
||||||
|
|
||||||
|
Located in `utils.py`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
def get_product_price_for_pricelist(
|
||||||
|
product,
|
||||||
|
qty,
|
||||||
|
pricelist,
|
||||||
|
partner=None,
|
||||||
|
uom=None,
|
||||||
|
date=None,
|
||||||
|
include_tax=False
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Parameters**:
|
||||||
|
- `product`: Product record (product.product or product.template)
|
||||||
|
- `qty`: Quantity
|
||||||
|
- `pricelist`: Pricelist to use for calculation
|
||||||
|
- `partner`: Partner record (optional)
|
||||||
|
- `uom`: Unit of measure (optional, uses product default if not provided)
|
||||||
|
- `date`: Date for pricelist rules (optional, uses today if not provided)
|
||||||
|
- `include_tax`: Boolean, whether to include taxes in the result
|
||||||
|
|
||||||
|
**Returns**: Decimal price
|
||||||
|
|
||||||
|
### How It Works
|
||||||
|
|
||||||
|
1. Gets base price from pricelist
|
||||||
|
2. Applies any applicable discounts
|
||||||
|
3. Converts price if different UoM is specified
|
||||||
|
4. Adds taxes if `include_tax=True`
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- `account` (Odoo core)
|
||||||
|
- `product` (Odoo core)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose exec odoo odoo -d odoo -u product_get_price_helper --stop-after-init
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Example: Calculate Price with Tax
|
||||||
|
|
||||||
|
```python
|
||||||
|
from odoo.addons.product_get_price_helper.utils import get_product_price_for_pricelist
|
||||||
|
|
||||||
|
price = get_product_price_for_pricelist(
|
||||||
|
product=product_record,
|
||||||
|
qty=10,
|
||||||
|
pricelist=pricelist_record,
|
||||||
|
partner=partner_record,
|
||||||
|
include_tax=True
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example: Calculate Price with Different UoM
|
||||||
|
|
||||||
|
```python
|
||||||
|
price = get_product_price_for_pricelist(
|
||||||
|
product=product_record,
|
||||||
|
qty=1,
|
||||||
|
pricelist=pricelist_record,
|
||||||
|
uom=kg_uom, # Different from product's default UoM
|
||||||
|
include_tax=False
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## OCA Source
|
||||||
|
|
||||||
|
- **Repository**: [product-attribute](https://github.com/OCA/product-attribute)
|
||||||
|
- **Original Author**: ACSONE SA/NV
|
||||||
|
- **License**: AGPL-3
|
||||||
|
|
||||||
|
## Modifications for Kidekoop
|
||||||
|
|
||||||
|
None - Used as-is from OCA.
|
||||||
|
|
||||||
|
## Used By
|
||||||
|
|
||||||
|
This helper is used by other modules in the project:
|
||||||
|
- `product_sale_price_from_pricelist` - For automatic price calculations
|
||||||
|
- `product_price_category` - For category-based pricing
|
||||||
|
|
||||||
|
## Demo Data
|
||||||
|
|
||||||
|
Includes demo data with:
|
||||||
|
- Sample accounts
|
||||||
|
- Sample pricelists
|
||||||
|
|
||||||
|
Located in `demo/` directory.
|
||||||
|
|
||||||
|
## Translations
|
||||||
|
|
||||||
|
- ✅ Spanish (es)
|
||||||
|
- ✅ Euskera (eu)
|
||||||
|
|
||||||
|
Located in `i18n/` directory.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Version**: 18.0.1.1.0
|
||||||
|
**License**: AGPL-3
|
||||||
119
product_main_seller/README.md
Normal file
119
product_main_seller/README.md
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
# Product Main Seller
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Adds a "Main Vendor" field to products that automatically tracks the primary supplier based on supplierinfo sequence.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Automatic Main Vendor**: Computed field showing the primary supplier
|
||||||
|
- **Based on Sequence**: Uses the supplierinfo with the lowest sequence number
|
||||||
|
- **Visible in Views**: Shows in product form and tree views
|
||||||
|
- **Searchable**: Can search and filter products by main vendor
|
||||||
|
- **Related Fields**: Access to vendor name and reference
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
### Models Extended
|
||||||
|
|
||||||
|
- `product.template`: Main product template
|
||||||
|
- `product.product`: Product variants
|
||||||
|
|
||||||
|
### Fields Added
|
||||||
|
|
||||||
|
- `default_supplier_id` (Many2one → res.partner, computed, stored)
|
||||||
|
- The main vendor for this product
|
||||||
|
- Computed from `seller_ids` with lowest sequence
|
||||||
|
- Stored for performance
|
||||||
|
- Searchable
|
||||||
|
|
||||||
|
- `default_supplier_ref` (Char, related to `default_supplier_id.ref`)
|
||||||
|
- The supplier's reference code
|
||||||
|
- Readonly
|
||||||
|
|
||||||
|
### Computation Logic
|
||||||
|
|
||||||
|
The main vendor is determined by:
|
||||||
|
1. Looking at all supplierinfo records (`seller_ids`)
|
||||||
|
2. Filtering for valid suppliers (not companies)
|
||||||
|
3. Selecting the one with the **lowest sequence** number
|
||||||
|
4. If no sequence, uses the first one
|
||||||
|
|
||||||
|
### Migration Hook
|
||||||
|
|
||||||
|
Includes `pre_init_hook` that:
|
||||||
|
- Populates `default_supplier_id` on existing products during installation
|
||||||
|
- Ensures data consistency from the start
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- `purchase` (Odoo core)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose exec odoo odoo -d odoo -u product_main_seller --stop-after-init
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Viewing Main Vendor
|
||||||
|
|
||||||
|
1. Open a product form (Products > Products > [Product])
|
||||||
|
2. See "Main Vendor" field (usually in Purchase tab)
|
||||||
|
3. Field is automatically computed from vendor list
|
||||||
|
|
||||||
|
### Changing Main Vendor
|
||||||
|
|
||||||
|
To change the main vendor:
|
||||||
|
1. Go to product form > Purchase tab
|
||||||
|
2. Edit the vendor list (`seller_ids`)
|
||||||
|
3. Change the sequence numbers (lower = more priority)
|
||||||
|
4. Save - the "Main Vendor" will update automatically
|
||||||
|
|
||||||
|
### Searching by Vendor
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Find all products from a specific vendor
|
||||||
|
products = self.env['product.template'].search([
|
||||||
|
('default_supplier_id', '=', vendor_id)
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
|
## OCA Source
|
||||||
|
|
||||||
|
- **Repository**: [purchase-workflow](https://github.com/OCA/purchase-workflow)
|
||||||
|
- **Original Author**: GRAP
|
||||||
|
- **Maintainers**: legalsylvain, quentinDupont
|
||||||
|
- **License**: AGPL-3
|
||||||
|
|
||||||
|
## Modifications for Kidekoop
|
||||||
|
|
||||||
|
None - Used as-is from OCA.
|
||||||
|
|
||||||
|
## Use Cases in Kidekoop
|
||||||
|
|
||||||
|
This module is critical for:
|
||||||
|
- `product_price_category_supplier`: Bulk updating products by main vendor
|
||||||
|
- Purchase order management
|
||||||
|
- Vendor performance analysis
|
||||||
|
- Inventory planning by supplier
|
||||||
|
|
||||||
|
## Views Modified
|
||||||
|
|
||||||
|
- Product Template Form View
|
||||||
|
- Product Template Tree View
|
||||||
|
- Product Variant Form View
|
||||||
|
|
||||||
|
## Translations
|
||||||
|
|
||||||
|
- ✅ Spanish (es)
|
||||||
|
- ✅ Euskera (eu)
|
||||||
|
|
||||||
|
Located in `i18n/` directory.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Version**: 18.0.1.0.0
|
||||||
|
**Category**: Purchase
|
||||||
|
**License**: AGPL-3
|
||||||
65
product_origin/README.md
Normal file
65
product_origin/README.md
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
# Product Origin
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Adds an origin field to products to track where they come from (geographic origin).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Origin Field**: Adds a text field to store the product's origin
|
||||||
|
- **Visible in Views**: Shows in both product template and product variant forms
|
||||||
|
- **Simple Implementation**: Extends core product models
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
### Models Extended
|
||||||
|
|
||||||
|
- `product.template`: Main product template
|
||||||
|
- `product.product`: Product variants
|
||||||
|
|
||||||
|
### Fields Added
|
||||||
|
|
||||||
|
- `origin` (Char): Text field for product origin
|
||||||
|
|
||||||
|
### Views Modified
|
||||||
|
|
||||||
|
- Product Template Form
|
||||||
|
- Product Variant Form
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- `product` (Odoo core)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose exec odoo odoo -d odoo -u product_origin --stop-after-init
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. Open a product form (Products > Products > [Product])
|
||||||
|
2. Find the "Origin" field
|
||||||
|
3. Enter the geographic origin (e.g., "Spain", "France", "Local")
|
||||||
|
|
||||||
|
## OCA Source
|
||||||
|
|
||||||
|
- **Repository**: [product-attribute](https://github.com/OCA/product-attribute)
|
||||||
|
- **Original Authors**: ACSONE SA/NV, GRAP
|
||||||
|
- **License**: AGPL-3
|
||||||
|
|
||||||
|
## Modifications for Kidekoop
|
||||||
|
|
||||||
|
None - Used as-is from OCA.
|
||||||
|
|
||||||
|
## Translations
|
||||||
|
|
||||||
|
- ✅ Spanish (es)
|
||||||
|
- ✅ Euskera (eu)
|
||||||
|
|
||||||
|
Located in `i18n/` directory.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Version**: 18.0.1.0.0
|
||||||
|
**License**: AGPL-3
|
||||||
Loading…
Add table
Add a link
Reference in a new issue