-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[15.0][upd] conditional readonly added to hold_picking_until_payment [15.0][upd] hold_picking_until_payment set to true by default [15.0][IMP] Base stock_picking_on_hold on sale_stock_picking_blocking
- Loading branch information
1 parent
5c2d077
commit 40e579c
Showing
15 changed files
with
239 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_picking_on_hold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
=================================================== | ||
Sale Payment Method - Hold Pickings (Until Payment) | ||
=================================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Production/Stable | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github | ||
:target: https://github.com/OCA/sale-workflow/tree/15.0/stock_picking_on_hold | ||
:alt: OCA/sale-workflow | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-stock_picking_on_hold | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/167/15.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to automatically hold a sale order's deliveries until the invoice is paid | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
1) Set on payment methods whether they should block deliveries until paid | ||
2) Set payment method on sale order | ||
3) A sale order's picking won't be created until it is paid | ||
|
||
|
||
Configuration | ||
============= | ||
|
||
Go to Invoicing > Payment Methods > Select your payment method > Enable "Hold Picking Until Payment" | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Thomas Rehn <[email protected]> | ||
* Katja Matthes <[email protected]> | ||
* Dhara Solanki <[email protected]> | ||
* Ruben Ortlam <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/15.0/stock_picking_on_hold>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Sale Payment Method - Hold Pickings (until payment)", | ||
"version": "15.0.1.0.0", | ||
"website": "https://github.com/OCA/sale-workflow", | ||
"category": "Warehouse", | ||
"summary": """ | ||
Sale Payment Method - Hold Pickings until payment | ||
=================================================== | ||
* This module allows to hold the picking until the invoice is paid""", | ||
"depends": [ | ||
"stock", | ||
"sale_stock_picking_blocking", | ||
"account_payment_mode", | ||
], | ||
"author": "initOS GmbH, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"data": [ | ||
"views/payment_method.xml", | ||
"views/sale_order_view.xml", | ||
], | ||
"installable": True, | ||
"application": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import payment_method, sale_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class PaymentMethod(models.Model): | ||
_inherit = "account.payment.method" | ||
|
||
hold_picking_until_payment = fields.Boolean( | ||
help="If set to true, pickings will not be automatically confirmed when " | ||
"the invoice has not been paid.", | ||
default=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
payment_method_id = fields.Many2one( | ||
"account.payment.method", | ||
string="Payment Method", | ||
ondelete="restrict", | ||
) | ||
|
||
def auto_set_invoice_block(self): | ||
recs = self.filtered_domain( | ||
[("payment_method_id.hold_picking_until_payment", "=", True)] | ||
) | ||
|
||
if not recs: | ||
return | ||
|
||
block_reason = self.env.ref("sale_stock_picking_blocking.pay_before_delivery") | ||
|
||
# Block records that are not yet invoiced or draft | ||
# Unblock the rest | ||
block = recs.filtered_domain( | ||
[ | ||
"|", | ||
"&", | ||
("state", "=", "draft"), | ||
("invoice_status", "=", "no"), | ||
("invoice_status", "!=", "invoiced"), | ||
] | ||
) | ||
|
||
unblock = recs - block | ||
|
||
block.write({"delivery_block_id": block_reason.id}) | ||
unblock.action_remove_delivery_block() | ||
|
||
def onchange_partner_id(self): | ||
result = super().onchange_partner_id() | ||
|
||
self.auto_set_invoice_block() | ||
|
||
return result | ||
|
||
def _get_invoice_status(self): | ||
result = super()._get_invoice_status() | ||
|
||
self.auto_set_invoice_block() | ||
|
||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#. Go to Invoicing > Payment Methods > Select your payment method > Enable "Hold Picking Untill Payment" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* Thomas Rehn <[email protected]> | ||
* Katja Matthes <[email protected]> | ||
* Dhara Solanki <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows to hold the picking until the invoice is paid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To use functionality of module, | ||
|
||
1) You need to generate "Sale Order" using "Payment Method: Enabled Hold Picking Untill Payment" | ||
2) Picking can not "confirm" untill the payment is "confirmed" of that Sale Order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="payment_method_view_form_picking_on_hold" model="ir.ui.view"> | ||
<field name="name">sale_payment_method.payment_method.view_form</field> | ||
<field name="model">account.payment.method</field> | ||
<field | ||
name="inherit_id" | ||
ref="account_payment_mode.account_payment_method_form" | ||
/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='payment_type']" position="after"> | ||
<field name="hold_picking_until_payment" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="sale_order_view_form_inherit_payment_method" model="ir.ui.view"> | ||
<field name="name">sale.order.payment_method.view_form</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//group[@name='sale_info']//field[@name='invoice_status']" | ||
position="after" | ||
> | ||
<field name="payment_method_id" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="view_sale_order_tree_stock_picking_on_hold" model="ir.ui.view"> | ||
<field name="name">sale.order.tree.stock_picking_on_hold</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_tree" /> | ||
<field name="arch" type="xml"> | ||
<field name="state" position="after"> | ||
<field name='payment_method_id' /> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |