Skip to content
Health
60/100
fair
  • Security25/25
    No findings
  • Activity25/25
    Last human commit 1 month ago
  • Required by5/25
    0 modules depend on it
  • Maturity5/25
    In 1 Odoo series since 19.0

Heuristic over the facts below, not an audit · How it's computed

Security findings
Grave / minor (static analysis)
Required by
0
Modules depending on it
External deps
1 pip · 0 bin
Python packages / system binaries
License
LGPL-3
No conflicts with its dependencies
Folder size
0.04 MB
Module directory on disk
Code analysis 0 migration notes 1 model 0 views 0 HTTP endpoints

Description

This module is the glue between Sale Partner Sale Contact and the eCommerce (website_sale).

When a portal user who is a contact person of a company places an order on the website, the order is created with the contact person as customer (partner_id). The auto-switch logic of Sale Partner Sale Contact is implemented as an onchange and therefore never runs for website orders.

This module applies the switch when the website order is confirmed:

  • partner_id is replaced by the commercial partner (the company);
  • the contact person who placed the order is stored in the Sale Contact field (sale_contact_partner_id);
  • the invoice and delivery addresses chosen during checkout, the fiscal position and the payment terms are preserved.

The switch is deliberately not applied while the order is still a cart: website_sale resets the cart customer to the logged-in user's partner on every request and looks up abandoned carts by that partner, so an earlier switch would be reverted and would break cart recovery.

Dependencies

Code analysis

Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.

Views touched 0

No views found for this module.

HTTP endpoints 0

No HTTP endpoints found for this module.

Models touched 1

New fields (0)

No new fields.

Public methods (1)
  • action_confirm(self)
    Apply the contact-to-company switch on website orders. Website orders are created in code with ``partner_id`` set to the portal user's partner (the contact person), so the auto-switch onchange of ``sale.contact.mixin`` never runs for them. The switch cannot be applied while the order is still a cart either, because ``website_sale`` resets ``partner_id`` back to the logged-in user's partner on every request while the order is draft (see ``Website._get_and_cache_current_cart``) and looks up abandoned carts by that same partner. Confirmation is therefore the first stable point to promote the commercial partner. The switch is applied after ``super()`` so that: * the order confirmation email is sent to the person who actually placed the order, not to the company; * documents created on confirmation (e.g. delivery orders) are generated with the addresses chosen at checkout; * the pricelist is not recomputed (``_compute_pricelist_id`` skips non-draft orders).