Skip to content

Commit

Permalink
[ADD] Add setting to define behavior when no payment method is set
Browse files Browse the repository at this point in the history
[ADD] German translation
  • Loading branch information
ortlam committed Sep 26, 2023
1 parent f223b21 commit c8fcad5
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 6 deletions.
1 change: 1 addition & 0 deletions stock_picking_on_hold/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"license": "AGPL-3",
"data": [
"views/payment_method.xml",
"views/res_config_settings_view.xml",
"views/sale_order_view.xml",
],
"installable": True,
Expand Down
45 changes: 45 additions & 0 deletions stock_picking_on_hold/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_on_hold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-26 09:38+0000\n"
"PO-Revision-Date: 2023-09-26 09:38+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_picking_on_hold
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_account_payment_method__hold_picking_until_payment
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_res_config_settings__hold_picking_until_payment
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_webkul_website_addons__hold_picking_until_payment
msgid "Hold Picking Until Payment"
msgstr "Blockiere Lieferung vor Zahlung"

#. module: stock_picking_on_hold
#: model:ir.model.fields,help:stock_picking_on_hold.field_account_payment_method__hold_picking_until_payment
msgid "Hold deliveries on sale orders with this payment method until invoiced"
msgstr "Blockiert Lieferungen an Verkaufsaufträgen mit dieser Zahlmethode bis der Auftrag abgerechnet ist"

#. module: stock_picking_on_hold
#: model:ir.model.fields,help:stock_picking_on_hold.field_res_config_settings__hold_picking_until_payment
#: model:ir.model.fields,help:stock_picking_on_hold.field_webkul_website_addons__hold_picking_until_payment
#: model_terms:ir.ui.view,arch_db:stock_picking_on_hold.res_config_settings_view_form_inherit
msgid "Hold deliveries on sale orders without a payment method until invoiced"
msgstr "Blockiert Lieferungen an Verkaufsaufträgen ohne Zahlmethode bis der Auftrag abgerechnet ist"

#. module: stock_picking_on_hold
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_sale_order__payment_method_id
msgid "Payment Method"
msgstr "Zahlungsmethode"

#. module: stock_picking_on_hold
#: model:ir.model,name:stock_picking_on_hold.model_account_payment_method
msgid "Payment Methods"
msgstr "Zahlungsmethoden"
45 changes: 45 additions & 0 deletions stock_picking_on_hold/i18n/stock_picking_on_hold.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_on_hold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-26 10:30+0000\n"
"PO-Revision-Date: 2023-09-26 10:30+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_picking_on_hold
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_account_payment_method__hold_picking_until_payment
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_res_config_settings__hold_picking_until_payment
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_webkul_website_addons__hold_picking_until_payment
msgid "Hold Picking Until Payment"
msgstr ""

#. module: stock_picking_on_hold
#: model:ir.model.fields,help:stock_picking_on_hold.field_account_payment_method__hold_picking_until_payment
msgid "Hold deliveries on sale orders with this payment method until invoiced"
msgstr ""

#. module: stock_picking_on_hold
#: model:ir.model.fields,help:stock_picking_on_hold.field_res_config_settings__hold_picking_until_payment
#: model:ir.model.fields,help:stock_picking_on_hold.field_webkul_website_addons__hold_picking_until_payment
#: model_terms:ir.ui.view,arch_db:stock_picking_on_hold.res_config_settings_view_form_inherit
msgid "Hold deliveries on sale orders without a payment method until invoiced"
msgstr ""

#. module: stock_picking_on_hold
#: model:ir.model.fields,field_description:stock_picking_on_hold.field_sale_order__payment_method_id
msgid "Payment Method"
msgstr ""

#. module: stock_picking_on_hold
#: model:ir.model,name:stock_picking_on_hold.model_account_payment_method
msgid "Payment Methods"
msgstr ""
2 changes: 1 addition & 1 deletion stock_picking_on_hold/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import payment_method, sale_order
from . import payment_method, res_config_settings, sale_order
3 changes: 1 addition & 2 deletions stock_picking_on_hold/models/payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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.",
help="Hold deliveries on sale orders with this payment method until invoiced",
default=True,
)
13 changes: 13 additions & 0 deletions stock_picking_on_hold/models/res_config_settings.py
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 ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

hold_picking_until_payment = fields.Boolean(
help="Hold deliveries on sale orders without a payment method until invoiced",
config_parameter="stock_picking_on_hold.hold_picking_until_payment",
default=True,
)
11 changes: 8 additions & 3 deletions stock_picking_on_hold/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ class SaleOrder(models.Model):
)

def auto_set_invoice_block(self):
recs = self.filtered_domain(
[("payment_method_id.hold_picking_until_payment", "=", True)]
)
default_hold = self.env["ir.config_parameter"].sudo().get_param("stock_picking_on_hold.hold_picking_until_payment", False)

domain = [("payment_method_id.hold_picking_until_payment", "=", True)]
if default_hold:
domain.insert(0, "|")
domain.append(("payment_method_id", "=", False))

recs = self.filtered_domain(domain)

if not recs:
return
Expand Down
28 changes: 28 additions & 0 deletions stock_picking_on_hold/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="res_config_settings_view_form_inherit" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@name='shipping_setting_container']" position="inside">
<div
class="col-12 col-lg-6 o_setting_box"
id="hold_picking_until_payment"
>
<div class="o_setting_left_pane">
<field name="hold_picking_until_payment" />
</div>
<div class="o_setting_right_pane">
<label for="hold_picking_until_payment" />
<div class="text-muted">
Hold deliveries on sale orders without a payment method until invoiced
</div>
</div>
</div>
</xpath>
</field>
</record>

</odoo>

0 comments on commit c8fcad5

Please sign in to comment.