dodil/erp-brick-consolidation

DODIL ERP brick: consolidation

src/brick_consolidation/domain/migration_map.py

"""The MigrationMap aggregate — the rules, and nothing else.

(odoo db, odoo model, odoo id) -> our natural key (shared.yaml conventions.odoo_migration)

No database, no HTTP, no identity: a rule here is true whoever calls it and however it is stored.
Generated by `erp-compose scaffold` from module.yaml; the TODO lines are the work left.
"""
from dataclasses import dataclass, field


@dataclass
class MigrationMap:
    """(odoo db, odoo model, odoo id) -> our natural key (shared.yaml conventions.odoo_migration)"""
    odoo_db: str
    odoo_model: str
    odoo_id: str
    natural_key: str = ""
    run_id: str = ""
    events: list = field(default_factory=list, repr=False, compare=False)

    def _record(self, event):
        self.events.append(event)
        return event