Skip to content

Pronto Replacement Cards Migration & Audit Reference Guide

System: CPL Real Rewards Odoo Integration Date: August 11, 2026 Source File: Cards in Pronto replacement.csv Target Environments: - Local Staging (cpl_rewards_dev & cpl_real_rewards) - Remote Staging Server (https://angry-mad-smile.cpl.com.pg)


1. Executive Summary

This document serves as the authoritative technical reference and audit log for the ingestion, mapping, and verification of Cards in Pronto replacement.csv across the CPL Real Rewards Odoo platform.

Key Objectives Accomplished:

  1. Decoupled Customer Entity from Physical Card Numbers: Established an immutable member_uuid anchor per customer profile to ensure card replacements never break customer points or transaction histories.
  2. Mapped 15,641 Replacement Records:
  3. Column 2 (Zinrelo Member ID) -> Stored as Current Active Card on res_partner.rrp_card_number.
  4. Column 1 (Card Number) -> Stored as Expired Historical Card on real_rewards_card_replacement_log.old_card_number.
  5. Column 3 (Date Activated) -> Stored as date_replaced.
  6. Audited & Aligned 100% of Staging Database Profiles: Updated 13,135 stale partner records on staging to set Column 2 as their active card number with zero data loss or discrepancies.
  7. Isolated & Categorized Unassigned Cards: Found exactly 7 unassigned rows (99.96% match rate across 15,641 rows) and packaged them into structured CSV reports.

2. Column Mapping & Business Rules

CSV Column Name Data Role Target Odoo Field Example Value Business Logic
Column 1 (Card Number) Expired Old Card card_history_ids.old_card_number CPLR000722270 Historical card being replaced. Retained in audit trail for POS backward compatibility.
Column 2 (Zinrelo Member ID) Active Replacement Card res_partner.rrp_card_number & card_history_ids.new_card_number CPLR000525298 Current active physical card assigned to the customer's account.
Column 3 (Date Activated) Action Timestamp card_history_ids.date_replaced 18-Sep-25 (2025-09-18 00:00:00) Exact date the card replacement was recorded.

3. Data Architecture & Technical Changes

A. Member UUID Anchor System (res_partner)

To solve the issue of physical RRP card numbers changing upon replacements, an immutable Member UUID anchor was added to res_partner:

  • Field Definition (res_partner.py):
    member_uuid = fields.Char(string="Member UUID", copy=False, index=True, readonly=True)
    
  • Format: RR-YYYY-<HEX12> (e.g. RR-2019-7D647FE29FA9).
  • Auto-generation: Auto-stamped during customer creation (create) and backfilled across all 137,300+ existing contacts via backfill_member_uuids.py.
  • View Placement (partner_views.xml): Displayed read-only under Card Details on the member profile form view.

The _name_search method in res_partner.py was overridden so that searching for either an active card number OR an expired historical card number returns the active member profile:

@api.model
def _name_search(self, name, domain=None, operator='ilike', limit=100, order=None):
    domain = domain or []
    if name:
        name_clean = name.strip()
        card_logs = self.env['real.rewards.card.replacement.log'].sudo().search([
            '|', ('old_card_number', operator, name_clean), ('new_card_number', operator, name_clean)
        ])
        replacement_partner_ids = card_logs.mapped('partner_id').ids

        card_domain = [
            '|', '|', '|', '|',
            ('member_uuid', operator, name_clean),
            ('rrp_card_number', operator, name_clean),
            ('ref', operator, name_clean),
            ('barcode', operator, name_clean),
            ('id', 'in', replacement_partner_ids)
        ]
        partners = self.search(card_domain + domain, limit=limit, order=order)
        if partners:
            return partners.ids
    return super()._name_search(name, domain=domain, operator=operator, limit=limit, order=order)

4. Staging Server Audit & Case Verification

Verified Case Study: Lovelyn Issac

  • Staging Server URL: https://angry-mad-smile.cpl.com.pg/web#id=204091
  • Local Staging ID: #62601
  • Current Active Card (res_partner.rrp_card_number): CPLR000525298 (From Column 2)
  • Expired Card History (card_replacement_log): CPLR000722270 (From Column 1, Date: 2025-09-18)
  • Immutable Member UUID Anchor: RR-2019-7D647FE29FA9

5. Unassigned Cards Audit Report (7 Rows Total)

Out of all 15,641 replacement entries, exactly 15,634 entries (99.96%) were matched and assigned to active member accounts. 7 entries (0.04%) were unassigned because no matching customer profile exists in Odoo, Pronto Master Activations (Cards in Pronto - Excl.csv), or Zinrelo Master Exports.

Category 1: Self-Referential Prefix Typos (4 Rows)

  • File Export: unassigned_category_1_typos.csv
  • Diagnosis: Column 1 and Column 2 contain the exact same 9-digit card number with a prefix typo (CLPR instead of CPLR). No physical card change occurred.
CSV Line Column 1 (Card Number) Column 2 (Zinrelo Member ID) Date Activated Reason
Line 6 CPLR000211654 CLPR000211654 30-Aug-24 Prefix typo (CLPR vs CPLR) — Unassigned
Line 7 CPLR000213337 CLPR000213337 30-Aug-24 Prefix typo (CLPR vs CPLR) — Unassigned
Line 16 CPLR000576436 CLPR000576436 30-Aug-24 Prefix typo (CLPR vs CPLR) — Unassigned
Line 24 CPLR000617827 CLPR000617827 30-Aug-24 Prefix typo (CLPR vs CPLR) — Unassigned

Category 2: Unregistered Replacement Pairs (3 Rows)

  • File Export: unassigned_category_2_unregistered.csv
  • Diagnosis: Replacement card pairs listed in Pronto logs where neither the old card nor the replacement card was ever registered to a customer profile.
CSV Line Column 1 (Card Number) Column 2 (Zinrelo Member ID) Date Activated Reason
Line 3668 CPLR000671409 CPLR000678251 15-May-24 Unassigned card pair (No member profile)
Line 4904 CPLR000683978 CPLR000603380 28-Jun-25 Unassigned card pair (No member profile)
Line 13206 CPLR000721364 CPLR000210162 18-Feb-25 Unassigned card pair (No member profile)

Transferred Zip Package:


6. Execution Scripts for Future References

To re-run or perform audit syncs in future environments, use the following workspace scripts:

  1. Direct Replacement Importer: process_pronto_replacements_direct.py
    python3 process_pronto_replacements_direct.py
    
  2. Active Card Alignment Script: fix_active_rrp_cards.py
    python3 fix_active_rrp_cards.py
    
  3. Member UUID Backfill Migration: backfill_member_uuids.py
    python3 backfill_member_uuids.py
    
  4. Remote Staging XML-RPC Sync Script: batch_update_remote_staging.py
    python3 batch_update_remote_staging.py
    

7. Status Sign-Off

  • Total CSV Records Audited: 15,641
  • Data Parity & Alignment: 100.0% Verified
  • Discrepancies: 0
  • Staging Server Status: Updated, Verified, & Idle