España - Reporte DeCA
l10n_es_deca_oca · OCA/l10n-spain
-
Security25/25No findings
-
Activity25/25Last human commit 1 month ago
-
Required by15/251 module depends on it
-
Maturity5/25In 1 Odoo series since 19.0
Heuristic over the facts below, not an audit · How it's computed
Migration considerations
- Raw `cr.execute()` INSERT/UPDATE/DELETE bypasses the ORM (no compute/constrains/tracking/mail): `WITH move_qty AS ( SELECT sm.id, pt.uom_id AS prod_uom_id, prod_uom.factor AS prod_uom_factor, prod_uom.parent_path AS prod_uom_parent_path, COALESCE(pp.weight, 0.0) AS product_weight, CASE WHEN COALESCE(sm.quantity, 0.0) != 0.0 THEN ROUND( ( CASE WHEN sm.product_uom = pt.uom_id THEN sm.quantity ELSE sm.quantity * move_uom.factor / prod_uom.factor END )::numeric, %(precision)s ) ELSE COALESCE(sm.product_qty, 0.0)::numeric END AS product_qty FROM stock_move sm JOIN product_product pp ON pp.id = sm.product_id JOIN product_template pt ON pt.id = pp.product_tmpl_id JOIN uom_uom move_uom ON move_uom.id = sm.product_uom JOIN uom_uom prod_uom ON prod_uom.id = pt.uom_id WHERE sm.deca_weight IS NULL ) UPDATE stock_move sm SET deca_weight = ROUND( ( CASE WHEN split_part(mq.prod_uom_parent_path, '/', 1) = %(kgm_root)s THEN CASE WHEN mq.prod_uom_id = %(kgm_id)s THEN mq.product_qty ELSE mq.product_qty * mq.prod_uom_factor / %(kgm_factor)s END ELSE mq.product_qty * mq.product_weight END )::numeric, %(weight_precision)s ) FROM move_qty mq WHERE sm.id = mq.id` - re-check the table/column names still match after upgrading. (2 occurrences in this file) migration-raw-sql-write · source
Migration review checklist, not a compatibility verdict. "Migrating to X.0" applies once you upgrade to that version; "Since X.0" means this version already ignores or rejects that code. Methodology
Description
Este módulo proporciona el documento de control administrativo electrónico (DeCA) para el transporte terrestre de mercancías, adaptado a los requisitos legales de España dictados por el Ministerio de Transportes y Movilidad Sostenible.
El Documento de control electrónico se integra con los albaranes de Odoo y permite a los transportistas generar, imprimir y compartir el documento DeCA directamente.
Más información en la página oficial: Documento Electrónico de Control Administrativo (DeCA).
Inmutabilidad y Versionado
Para cumplir estrictamente con los requisitos legales sobre el documento DeCA:
- Generación inmutable: La primera vez que se imprime o se solicita un documento, se almacena de forma inmutable como archivo adjunto (
v1). - Preservación de URL/QR: Al compartir el enlace al transportista, siempre servirá de forma dinámica la última versión generada, manteniendo el mismo código QR impreso físicamente.
- Trazabilidad de Metadatos: El PDF incluye inyección automática de metadatos (/CreationDate y /ModDate) que indican cuándo se generó la primera versión y cuándo la versión actual, sirviendo como rastro de auditoría.
- Versionado inteligente: Si se alteran datos críticos en el albarán (matrículas, transportista, productos o bultos) tras haber emitido un DeCA, el sistema generará automáticamente una nueva versión (
v2,v3...) manteniendo siempre el histórico de archivos PDF previos adjuntos en Odoo.
Dependencies
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 4
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
report_deca |
report_deca | ir.ui.view | qweb | New |
report_deca_document |
report_deca_document | ir.ui.view | qweb | New |
view_picking_form_inherit_l10n_es_deca_oca |
stock.picking.view.form.inherit.l10n_es_deca_oca | stock.picking | form | Inherits stock.view_picking_form |
view_picking_type_form_inherit_l10n_es_deca_oca |
stock.picking.type.view.form.inherit.l10n_es_deca_oca | stock.picking.type | form | Inherits stock.view_picking_type_form |
HTTP endpoints 1
| Route(s) | Handler | Auth | Type | Methods | Flags |
|---|---|---|---|---|---|
/my/picking/<int:picking_id> |
DecaController.public_delivery_portal |
public | http | ALL | sudo |
Models touched 3
-
deca_weightFloatcompute='_compute_deca_weight'compute_sudo=Truedigits='Stock Weight'store=True
No public methods.
-
carrier_contact_idMany2one → res.partnercomodel_name='res.partner'help='Carrier contact whose details are printed on the DeCA'string='Carrier contact' -
deca_access_tokenTextcopy=Falsestring='Security access token to share url' -
deca_content_hashCharcopy=Falsereadonly=Truestring='DeCA Content Hash' -
deca_first_version_dateDatetimecopy=Falsereadonly=Truestring='DeCA First Version Date' -
deca_is_visibleBooleancompute='_compute_deca_is_visible' -
deca_versionIntegercopy=Falsedefault=0readonly=Truestring='DeCA Version' -
deca_weightFloatcompute='_compute_deca_weight'compute_sudo=Truedigits='Stock Weight'help='Total weight of the products in the picking.'store=True -
special_authorizationTextstring='Special traffic authorisations' -
special_authorization_historyTextcopy=Falsereadonly=Truestring='Special authorisation history' -
tractor_license_plateCharsize=8string='Main vehicle or tractor licence plate' -
tractor_license_plate_historyTextcopy=Falsereadonly=Truestring='Tractor licence plate history' -
trailer_license_plateCharsize=8string='Trailer or semi-trailer licence plate' -
trailer_license_plate_historyTextcopy=Falsereadonly=Truestring='Trailer licence plate history'
-
action_print_deca(self) -
write(self, vals)
-
l10n_es_deca_enabledBooleanhelp='Allows printing the DeCA report for incoming shipments.'string='Enable DeCA'
No public methods.
Loading…