| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Purchase (purchase)
• Invoicing (account) • Discuss (mail) • Inventory (stock) |
| Lines of code | 115 |
| Technical Name |
grev_od_stock_refund |
| License | OPL-1 |
| Website | https://grevlin.com |
| Versions | 17.0 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Purchase (purchase)
• Invoicing (account) • Discuss (mail) • Inventory (stock) |
| Lines of code | 115 |
| Technical Name |
grev_od_stock_refund |
| License | OPL-1 |
| Website | https://grevlin.com |
| Versions | 17.0 18.0 19.0 |
|
📦
Stock Return Validation for RefundsEnsure goods are physically returned before issuing credit notes — prevent accounting and inventory mismatches automatically.
|
|
|
|
|
|
Need Help?For support, contact us at odoo@grevlin.com Follow us on X: @GrevlinGlobal ⭐ 30 days free support ⭐ |
Stock Return Validation for Refunds
Require stock returns before allowing invoice refunds, preventing accounting and stock mismatches.
Overview
When creating credit notes (refunds), Odoo allows them regardless of whether the related goods have been physically returned. This creates a risk of accounting discrepancies where refunds are issued for goods that remain with the customer or are still in the company's warehouse.
Stock Return Validation for Refunds adds two layers of validation:
- Hard block -- prevents refund creation if the invoice's related deliveries or receipts have no stock returns at all.
- Quantity warning -- warns if the refunded quantity exceeds the returned stock quantity per line, with a company-level bypass setting.
The module works with both customer refunds (out_refund) and vendor refunds (in_refund), for invoices linked to sale or purchase orders. Standalone invoices are not affected.
Configuration
Bypass Setting
To allow credit notes to be posted even when refund quantities exceed returned stock:
- Go to :menuselection:`Accounting --> Configuration --> Settings`.
- Under the :guilabel:`Credit Notes` section, enable :guilabel:`Allow Refunds Without Full Stock Return`.
- Click :guilabel:`Save`.
Note
This setting only bypasses the quantity check at posting time (Check 2). The hard block when creating reversals (Check 1) always applies regardless of this setting.
Usage
Check 1: Reversal Wizard Block
When an accountant attempts to create a credit note via the :guilabel:`Reverse` button on a posted invoice:
- The module checks if any completed delivery (for sales) or receipt (for purchases) linked to the invoice has a stock return.
- If no returns exist at all, a :guilabel:`UserError` is raised and the refund is blocked.
- The accountant must process a stock return before trying again.
Tip
This check applies to both customer invoices and vendor bills. If the invoice has no linked sale or purchase order (standalone invoice), the check is skipped.
Check 2: Quantity Warning at Posting
When posting a credit note (out_refund or in_refund):
- The module compares each product line's refund quantity against the total returned stock quantity.
- If any line has a refund quantity exceeding the returned quantity, a :guilabel:`UserError` is raised listing the mismatched lines.
- The accountant can either:
- Process additional stock returns to match the quantities.
- Enable the bypass setting in :menuselection:`Accounting --> Configuration --> Settings`.
Technical Details
Models Inherited
| Model | Type | Purpose |
|---|---|---|
| account.move | Persistent | Quantity check at posting (action_post) |
| account.move.reversal | Transient (wizard) | Return existence check (reverse_moves) |
| res.company | Persistent | Stores the bypass setting |
| res.config.settings | Transient | Exposes the bypass setting in Accounting settings |
Fields Added
| Field | Model | Type | Description |
|---|---|---|---|
| force_refund_without_return | res.company | Boolean | Allow posting refunds without full stock returns |
| force_refund_without_return | res.config.settings | Boolean (related) | Settings UI field linked to the company field |
Key Methods
- _check_stock_returns()
- On account.move.reversal. Verifies that at least one stock return exists for the deliveries or receipts linked to the invoice being reversed. Called before reverse_moves().
- _check_refund_return_quantities()
- On account.move. Compares each credit note line's quantity against returned stock quantities. Called before action_post(). Skipped when force_refund_without_return is enabled on the company.
- _get_order_line_and_picking_code(line)
- On account.move. Helper that returns the linked order lines and picking type code for a credit note line.
Dependencies
| Module | Purpose |
|---|---|
| sale_stock | Links sale orders to stock pickings |
| purchase_stock | Links purchase orders to stock pickings |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module