Connect modules connect_memory_sale

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.order emits 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 sale state emits a state_change event tagged signal: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.move of type out_invoice, out_refund, in_invoice or in_refund emits a lifecycle event with amounts, due date and payment state. Each account.partial.reconcile against one of those documents emits a payment event; a payment landing after the due date adds a signal:late_payment tag 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, default 6), digest_min_invoices (minimum signal before a partner produces a digest, default 3) and digest_batch_size (partners per run, default 50). The cron ships with noupdate="1", so changing its interval survives module upgrades.

  • Capture can never break the sale

    Every path snapshots the record before super() and wraps emission in try/except. A failure to build or enqueue a memory event is logged under the connect_memory_sale logger 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_memory configured 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.move and account.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_invoices in 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.