Skip to content

Commit 7b04a64

Browse files
jans23sudhir-erpharborDmytro Kashuba
authored
add sale_order_picking_hold_paid (#179)
Co-authored-by: Sudhir ERP Harbor <[email protected]> Co-authored-by: Dmytro Kashuba <[email protected]>
1 parent df9c88a commit 7b04a64

17 files changed

+698
-1
lines changed

payment_bitcoin/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Nitrokey GmbH, Odoo Community Association (OCA)",
77
"website": "https://github.com/OCA/server-tools",
88
"license": "LGPL-3",
9-
"depends": ["payment", "website_sale", "website_sale_payment", "base_automation"],
9+
"depends": ["payment", "website_sale", "base_automation"],
1010
"data": [
1111
"security/ir.model.access.csv",
1212
"data/base_automation.xml",

payment_bitcoin/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
payment_acquirer,
66
payment_transaction,
77
res_config_settings,
8+
sale,
89
)

payment_bitcoin/models/sale.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from odoo import fields, models
2+
3+
4+
class SaleOrder(models.Model):
5+
_inherit = "sale.order"
6+
7+
payment_tx_id = fields.Many2one("payment.transaction", string="Last Transaction")
8+
payment_acquirer_id = fields.Many2one(
9+
"payment.acquirer",
10+
string="Payment Acquirer",
11+
related="payment_tx_id.acquirer_id",
12+
store=True,
13+
)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
============================
2+
Sale Order Picking Hold Paid
3+
============================
4+
5+
This module adds a dropdown field "Delivery Block Reason" to payment terms. If a sale order is validated with a payment term where a delivery block reason is selected, the creation of the picking will be held until the invoice has been fully paid.
6+
7+
The creation of manufacturing orders is not blocked, allowing products with routes Make-to-order and Manufacturing to proceed with production even if delivery is on hold.
8+
9+
Features
10+
--------
11+
12+
* Add "Delivery Block Reason" dropdown to payment terms
13+
* Add "Remove Block on Payment" checkbox to delivery block reasons for automatic removal upon payment
14+
* Automatically hold delivery orders for sale orders with payment terms that have a delivery block reason selected
15+
* Automatically create delivery orders when invoices are fully paid (if the block reason has "Remove Block on Payment" enabled)
16+
* Allow manufacturing orders to be created even when delivery is on hold
17+
18+
Configuration
19+
-------------
20+
21+
To configure this module, you need to:
22+
23+
1. Go to Accounting > Configuration > Payment Terms
24+
2. Edit or create a payment term
25+
3. Select a "Delivery Block Reason" from the dropdown if you want to hold deliveries until payment
26+
4. On the delivery block reason itself, enable "Remove Block on Payment" if you want the block to be automatically removed when the invoice is paid
27+
28+
Usage
29+
-----
30+
31+
To use this module:
32+
33+
1. Create a sale order and select a payment term with a "Delivery Block Reason" selected
34+
2. Confirm the sale order
35+
3. Create and post an invoice for the sale order
36+
4. No delivery order will be created until the invoice is fully paid
37+
5. Once the invoice is paid, the delivery order will be automatically created if the block reason has "Remove Block on Payment" enabled
38+
39+
For products with Make-to-order and Manufacturing routes, manufacturing orders will be created immediately upon sale order confirmation, regardless of payment status.
40+
41+
Bug Tracker
42+
-----------
43+
44+
Bugs are tracked on `GitHub Issues <https://github.com/Nitrokey/odoo-modules/issues>`_.
45+
In case of trouble, please check there if your issue has already been reported.
46+
47+
Credits
48+
-------
49+
50+
Authors
51+
~~~~~~~
52+
53+
* Nitrokey GmbH
54+
55+
Contributors
56+
~~~~~~~~~~~~
57+
58+
* Nitrokey GmbH <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2025 Nitrokey GmbH
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Sale Order Picking Hold Paid",
6+
"version": "15.0.1.0.0",
7+
"category": "Sales/Sales",
8+
"summary": "Hold pickings until invoice is paid based on payment terms",
9+
"author": "Nitrokey GmbH",
10+
"website": "https://github.com/OCA/server-tools",
11+
"license": "AGPL-3",
12+
"readme": "README.rst",
13+
"depends": [
14+
"sale_stock",
15+
"account",
16+
"mrp",
17+
"sale_stock_picking_blocking",
18+
],
19+
"data": [
20+
"views/account_payment_term_views.xml",
21+
"views/sale_stock_picking_blocking_reason_view.xml",
22+
"views/sale_order_views.xml",
23+
],
24+
"demo": [],
25+
"installable": True,
26+
"application": False,
27+
"auto_install": False,
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import account_move, account_payment_term, sale_delivery_block_reason, sale_order
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Nitrokey GmbH
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class AccountMove(models.Model):
8+
_inherit = "account.move"
9+
10+
def action_invoice_paid(self):
11+
"""Check if delivery blocks should be removed when invoice is paid."""
12+
res = super().action_invoice_paid()
13+
orders = self.filtered(lambda move: move.is_invoice()).mapped(
14+
"invoice_line_ids.sale_line_ids.order_id"
15+
)
16+
orders.with_context(auto_removal_on_payment=True).action_remove_delivery_block()
17+
return res
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Nitrokey GmbH
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class AccountPaymentTerm(models.Model):
8+
_inherit = "account.payment.term"
9+
10+
delivery_block_reason_id = fields.Many2one(
11+
"sale.delivery.block.reason",
12+
string="Delivery Block Reason",
13+
help="Select a delivery block reason that will be applied to orders using "
14+
"this payment term. Orders will be held until the invoice is fully paid.",
15+
)
16+
17+
def get_delivery_block_reason(self):
18+
"""Get the delivery block reason for this payment term."""
19+
return self.delivery_block_reason_id
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 Nitrokey GmbH
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class SaleDeliveryBlockReason(models.Model):
8+
_inherit = "sale.delivery.block.reason"
9+
10+
remove_on_payment = fields.Boolean(
11+
"Remove Block on Payment",
12+
help="If checked, this delivery block will be automatically removed "
13+
"when the invoice is paid",
14+
)

0 commit comments

Comments
 (0)