Customer Memory
Connect Memory — Sale & Payment Behavior
Memory events for sales, invoices, payments.
A domain add-on that feeds sales and finance activity into the Customer Memory pipeline built by connect_memory. It captures the sale-order lifecycle, renegotiations of already-confirmed orders, posted invoices and refunds, customer and vendor payments, and an hourly per-customer payment-behavior digest — every event handed to the shared outbox through the memory mixin, never to an engine directly.
The design rule is that remembering must not cost anything at the business layer. Each capture path snapshots the record before super() runs and wraps emission in a try/except, so a malformed envelope or an unavailable outbox is logged and forgotten rather than rolled back into the sale order. A single gate checks the memory master switch and that the partner is a genuine external party before any of it runs.
The module holds no configuration and adds no menus, access rules or views of its own — the master switch, the outbox and inbox screens and the retention policy all belong to connect_memory. Its only new field is an internal staleness cursor on res.partner that lets the hourly digest walk the customer base in batches.
What it offers
-
Sale order lifecycle capture
Creating a
sale.orderemits an event summarizing the order lines, amount and currency; confirming, cancelling or locking it emits a lifecycle event tagged with the outcome. Each transition keys on the record and the label, so replays collapse instead of duplicating. -
Renegotiation diffs on confirmed orders
Editing an order already in the
salestate emits astate_changeevent taggedsignal:renegotiation, carrying old→new pairs for tracked scalars (amount_total,date_order,commitment_date, …) and per-line add, update and delete diffs parsed from the order-line commands. -
Invoices, refunds and reconciled payments
Posting an
account.moveof typeout_invoice,out_refund,in_invoiceorin_refundemits a lifecycle event with amounts, due date and payment state. Eachaccount.partial.reconcileagainst one of those documents emits a payment event; a payment landing after the due date adds asignal:late_paymenttag and the day count. -
Hourly payment-behavior digest
A cron running
res.partner._memory_sale_payment_digest()rolls up how promptly each commercial partner pays — average days late, maximum days late and the share of invoices paid late — into a single observation event, so the engine gets a stable signal without replaying every payment. -
Digest tuning without an upgrade
Three system parameters control the job:
connect_memory_sale.digest_period_months(look-back window, default6),digest_min_invoices(minimum signal before a partner produces a digest, default3) anddigest_batch_size(partners per run, default50). The cron ships withnoupdate="1", so changing its interval survives module upgrades. -
Capture can never break the sale
Every path snapshots the record before
super()and wraps emission intry/except. A failure to build or enqueue a memory event is logged under theconnect_memory_salelogger and swallowed — it cannot roll back an order, an invoice posting or a reconciliation.
Scope of the current version
- This module only produces events. It needs
connect_memoryconfigured with its master switch on and an external memory engine draining the outbox — on its own it captures nothing. - It requires the Sales and Accounting apps: capture hooks live on
sale.order,account.moveandaccount.partial.reconcile. - There is no configuration UI of its own — no menu, no settings page. Tuning happens through system parameters and Settings ▸ Technical ▸ Scheduled Actions; the outbox and inbox are inspected from the Memory screens of
connect_memory. - Only external parties are captured. Orders, invoices and payments belonging to one of your own companies or to an internal employee are silently skipped.
- Only customer and vendor invoices and refunds are captured; plain journal entries and other move types are ignored.
- The digest is deliberately sparse: it revisits a partner at most once every 7 days, emits at most one observation per partner per ISO week, and stays silent for partners below
digest_min_invoicesin the look-back window. - It is licensed as its own Connect module. The license gate is silent — a license failure degrades to allow so business operations never block, but events are dropped when the check returns false.
Installs with full features free for 30 days; buy the license inside the module.