Skip to content

[17.0][ADD] purchase_financial_risk: vendor credit limit control for purchases#549

Open
alan196 wants to merge 1 commit into
OCA:17.0from
Jarsa-dev:17.0-add-purchase_financial_risk
Open

[17.0][ADD] purchase_financial_risk: vendor credit limit control for purchases#549
alan196 wants to merge 1 commit into
OCA:17.0from
Jarsa-dev:17.0-add-purchase_financial_risk

Conversation

@alan196

@alan196 alan196 commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Adds a new module that replicates the financial risk control logic of account_financial_risk and sale_financial_risk for the purchasing flow.

Features:

  • Credit limit per vendor with configurable currency (USD, MXN, etc.)
  • Financial risk computed from open POs (uninvoiced) + unpaid vendor bills
  • Blocks or warns on purchase order confirmation when limit is exceeded
  • Risk exception wizard for authorized users (Purchase Risk Manager group)
  • Risk indicators on vendor form view
  • Multi-currency support using res.currency._convert()
  • Full unit test coverage (TransactionCase, no demo data)

@alan196 alan196 force-pushed the 17.0-add-purchase_financial_risk branch 3 times, most recently from 99d456b to 118bcb7 Compare March 12, 2026 00:42
@alan196 alan196 changed the title [ADD] purchase_financial_risk: vendor credit limit control for purchases [17.0][ADD] purchase_financial_risk: vendor credit limit control for purchases Mar 19, 2026
@alan196 alan196 force-pushed the 17.0-add-purchase_financial_risk branch 7 times, most recently from 628d0ab to 773149f Compare March 19, 2026 15:57
@alan196 alan196 force-pushed the 17.0-add-purchase_financial_risk branch 2 times, most recently from 7668a24 to d85cd0e Compare March 30, 2026 15:30
This module manages financial risk and credit limits for vendors in purchases, mirroring the functionality of `account_financial_risk` for sales.

Main features:
- Adds a `purchase_risk_limit` to the `res.partner` model.
- Calculates total purchase risk by evaluating:
  - Uninvoiced Purchase Orders (`purchase_risk_po`).
  - Draft Vendor Bills (`purchase_risk_bill_draft`).
  - Open/Posted Unpaid Vendor Bills (`purchase_risk_bill_open`).
- Displays clickable risk elements in the Vendor form that open pivot views detailing the contributing records (`purchase.order.line` and `account.move`).
- Blocks the confirmation of Purchase Orders (`purchase.order`) AND the posting of Vendor Bills (`account.move`) when the total vendor purchase risk exceeds their limit via an explicit Exception wizard.
- Ensures robust security scopes requiring `Purchase Risk Manager` privileges to bypass the risk validations manually.
- Extensive test coverage evaluating memory `NewId` lookups over onchange boundaries, precise limits parsing, dynamic document validations and overrides blocks.
- Contains es_MX language translation files explicitly mapped for generic wizard blocking.
@alan196 alan196 force-pushed the 17.0-add-purchase_financial_risk branch from d85cd0e to 61c40f3 Compare March 30, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant