Handle Sale Order Pricelist in Origin and Organization #574

Merged
tobru merged 2 commits from odoo-pricelist-per-sale-order into main 2026-06-26 11:35:19 +00:00
Owner
No description provided.
Add per-origin and per-organization Odoo pricelist selection so sale
orders can use specific pricelists (e.g. "Exoscale Marketplace via
Servala") instead of only the currency-default ones.

- OrganizationOrigin.default_pricelist_id and Organization.pricelist_id
  (Django admin, dropdowns populated from Odoo).
- Resolution: org override -> origin default -> currency fallback
  (settings PRICELIST_IDS), exposed via get_effective_pricelist_id().
  Shared-sale-order orgs are excluded.
- Currency is derived from an explicitly-set pricelist in save().
- create_organization, sync_odoo and the recreate_sale_order fix all
  push the resolved pricelist.
- Sanity checker: pricelist_match (renamed from pricelist_currency_match)
  with a state-aware policy. The sync_pricelist fix auto-corrects only
  when safe and refuses, server-side, a currency-changing write on a
  sale order that already has lines or invoices.
- Staff org detail shows the effective pricelist and its source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Polish pricelist feature from review feedback
All checks were successful
Tests / test (push) Successful in 1m21s
b1055d349a
- Warn in the Django admin when the billing currency is auto-derived
  from the selected pricelist (previously silent).
- Show a friendly pricelist source label in the staff view
  (get_pricelist_source_display: "origin default", "currency fallback
  (CHF)", etc.) instead of the raw token.
- Fail-safe the sanity guard: refuse a pricelist fix on a sale order
  with lines or invoices when the currency cannot be verified against
  Odoo, not only when it is known to change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tobru merged commit b13665e3f5 into main 2026-06-26 11:35:19 +00:00
tobru deleted branch odoo-pricelist-per-sale-order 2026-06-26 11:35:19 +00:00
Sign in to join this conversation.
No description provided.