From 1c74bc049a3c160c38f3860bbbf393b6309aeb4e Mon Sep 17 00:00:00 2001
From: Hardik Suthar
Date: Sat, 6 Feb 2021 02:36:39 +0530
Subject: [PATCH 01/21] [MIG] account_payment_batch_process: Migration to 14.0
---
account_payment_batch_process/README.rst | 26 +
account_payment_batch_process/__init__.py | 5 +
account_payment_batch_process/__manifest__.py | 31 ++
.../models/__init__.py | 4 +
.../models/payment_adjustment_reason.py | 20 +
.../readme/CONTRIBUTORS.rst | 5 +
.../readme/CREDITS.rst | 1 +
.../readme/DESCRIPTION.rst | 5 +
.../readme/HISTORY.rst | 12 +
.../security/ir.model.access.csv | 5 +
.../static/description/icon.png | Bin 0 -> 9455 bytes
.../views/account_move.xml | 16 +
.../views/account_payment.xml | 29 ++
.../wizard/__init__.py | 6 +
.../wizard/account_payment_register.py | 461 ++++++++++++++++++
.../wizard/account_payment_register.xml | 133 +++++
.../wizard/invoice_payment_line.py | 103 ++++
17 files changed, 862 insertions(+)
create mode 100644 account_payment_batch_process/README.rst
create mode 100644 account_payment_batch_process/__init__.py
create mode 100644 account_payment_batch_process/__manifest__.py
create mode 100644 account_payment_batch_process/models/__init__.py
create mode 100644 account_payment_batch_process/models/payment_adjustment_reason.py
create mode 100644 account_payment_batch_process/readme/CONTRIBUTORS.rst
create mode 100644 account_payment_batch_process/readme/CREDITS.rst
create mode 100644 account_payment_batch_process/readme/DESCRIPTION.rst
create mode 100644 account_payment_batch_process/readme/HISTORY.rst
create mode 100644 account_payment_batch_process/security/ir.model.access.csv
create mode 100644 account_payment_batch_process/static/description/icon.png
create mode 100644 account_payment_batch_process/views/account_move.xml
create mode 100644 account_payment_batch_process/views/account_payment.xml
create mode 100644 account_payment_batch_process/wizard/__init__.py
create mode 100644 account_payment_batch_process/wizard/account_payment_register.py
create mode 100644 account_payment_batch_process/wizard/account_payment_register.xml
create mode 100644 account_payment_batch_process/wizard/invoice_payment_line.py
diff --git a/account_payment_batch_process/README.rst b/account_payment_batch_process/README.rst
new file mode 100644
index 00000000000..972aab7f7e4
--- /dev/null
+++ b/account_payment_batch_process/README.rst
@@ -0,0 +1,26 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+
+=============================
+OSI Batch Payments Processing
+=============================
+
+OSI Batch Payments Processing for Customers Invoices and Supplier Invoices/Vendor Bills.
+
+Payments to multiple vendors can be processed.
+Payments from multiple customers can be processed.
+
+Partial payments can be processed leaving invoice/bill open or writing off unpaid portion to a write-off account.
+
+Credits
+=======
+* Open Source Integrators
+
+Contributors
+============
+* Balaji Kannan
+* Bhavesh Odedra
+* Mayank Gosai
+* Sandip Mangukiya
+* Hardik Suthar
diff --git a/account_payment_batch_process/__init__.py b/account_payment_batch_process/__init__.py
new file mode 100644
index 00000000000..9c366a16c2e
--- /dev/null
+++ b/account_payment_batch_process/__init__.py
@@ -0,0 +1,5 @@
+# Copyright (C) 2019, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import models
+from . import wizard
diff --git a/account_payment_batch_process/__manifest__.py b/account_payment_batch_process/__manifest__.py
new file mode 100644
index 00000000000..42d5aaa26c8
--- /dev/null
+++ b/account_payment_batch_process/__manifest__.py
@@ -0,0 +1,31 @@
+# Copyright (C) 2021, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+{
+ "name": "Account Payment Batch Processing",
+ "version": "14.0.1.0.0",
+ "license": "AGPL-3",
+ "author": "Open Source Integrators, Odoo Community Association (OCA)",
+ "summary": """
+ Account Batch Payments Processing for Customers Invoices and
+ Supplier Invoices
+ """,
+ "category": "Extra",
+ "maintainer": "Open Source Integrators",
+ "website": "https://github.com/OCA/account-payment",
+ "depends": [
+ "account",
+ "account_check_printing",
+ "account_payment_order",
+ ],
+ "data": [
+ "security/ir.model.access.csv",
+ "wizard/account_payment_register.xml",
+ "views/account_move.xml",
+ "views/account_payment.xml",
+ ],
+ "external_dependencies": {
+ "python": ["num2words"],
+ },
+ "installable": True,
+}
diff --git a/account_payment_batch_process/models/__init__.py b/account_payment_batch_process/models/__init__.py
new file mode 100644
index 00000000000..4a707408c89
--- /dev/null
+++ b/account_payment_batch_process/models/__init__.py
@@ -0,0 +1,4 @@
+# Copyright (C) 2021, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import payment_adjustment_reason
diff --git a/account_payment_batch_process/models/payment_adjustment_reason.py b/account_payment_batch_process/models/payment_adjustment_reason.py
new file mode 100644
index 00000000000..d4c77876145
--- /dev/null
+++ b/account_payment_batch_process/models/payment_adjustment_reason.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2021, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import fields, models
+
+
+class PaymentAdjustmentReason(models.Model):
+ _name = "payment.adjustment.reason"
+ _rec_name = "code"
+ _description = "Payment Adjustment Reason"
+
+ code = fields.Char(string="Code", required=True, copy=False)
+ account_id = fields.Many2one("account.account", string="Account")
+ reason = fields.Text(string="Reason", copy=False)
+
+ def name_get(self):
+ result = []
+ for pay in self:
+ result.append((pay.id, "%s" % (pay.code or "")))
+ return result
diff --git a/account_payment_batch_process/readme/CONTRIBUTORS.rst b/account_payment_batch_process/readme/CONTRIBUTORS.rst
new file mode 100644
index 00000000000..a8e8821e4a7
--- /dev/null
+++ b/account_payment_batch_process/readme/CONTRIBUTORS.rst
@@ -0,0 +1,5 @@
+* Balaji Kannan
+* Bhavesh Odedra
+* Mayank Gosai
+* Sandip Mangukiya
+* Hardik Suthar
diff --git a/account_payment_batch_process/readme/CREDITS.rst b/account_payment_batch_process/readme/CREDITS.rst
new file mode 100644
index 00000000000..5849121741e
--- /dev/null
+++ b/account_payment_batch_process/readme/CREDITS.rst
@@ -0,0 +1 @@
+* Open Source Integrators
diff --git a/account_payment_batch_process/readme/DESCRIPTION.rst b/account_payment_batch_process/readme/DESCRIPTION.rst
new file mode 100644
index 00000000000..0efc1232c78
--- /dev/null
+++ b/account_payment_batch_process/readme/DESCRIPTION.rst
@@ -0,0 +1,5 @@
+Batch Payments Processing for Customers Invoices and Supplier Invoices/Vendor Bills.
+
+Payments to multiple vendors can be processed. Payments from multiple customers can be processed.
+
+Partial payments can be processed leaving invoice/bill open or writing off unpaid portion to a write-off account.
diff --git a/account_payment_batch_process/readme/HISTORY.rst b/account_payment_batch_process/readme/HISTORY.rst
new file mode 100644
index 00000000000..d9b70b93e97
--- /dev/null
+++ b/account_payment_batch_process/readme/HISTORY.rst
@@ -0,0 +1,12 @@
+12.0.1.1.0
+~~~~~~~~~~
+
+**Features**
+
+- Remove menu "Batch Payments" from Vendors and Customers
+- Remove menu "Register Payment" from batch invoices.
+
+12.0.1.0.0
+~~~~~~~~~~
+
+- Initial File
diff --git a/account_payment_batch_process/security/ir.model.access.csv b/account_payment_batch_process/security/ir.model.access.csv
new file mode 100644
index 00000000000..c7747e7738c
--- /dev/null
+++ b/account_payment_batch_process/security/ir.model.access.csv
@@ -0,0 +1,5 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_invoice_payment_line,invoice.payment.line,model_invoice_payment_line,base.group_user,1,1,1,0
+access_payment_adjustment_reason_manager,payment.adjustment.reason,model_payment_adjustment_reason,account.group_account_manager,1,1,1,1
+access_payment_adjustment_reason_user,payment.adjustment.reason,model_payment_adjustment_reason,account.group_account_user,1,0,0,0
+access_payment_adjustment_reason_invoice,payment.adjustment.reason,model_payment_adjustment_reason,account.group_account_invoice,1,0,0,0
diff --git a/account_payment_batch_process/static/description/icon.png b/account_payment_batch_process/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
literal 9455
zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJf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p4f2YFQrQtot5mn3wu_qprZ=>Ig-$
zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV(
z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb
zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4
z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{
zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx}
z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov
zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22
zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq
zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t<
z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k
z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp
z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{}
zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N
Xviia!U7SGha1wx#SCgwmn*{w2TRX*I
literal 0
HcmV?d00001
diff --git a/account_payment_batch_process/views/account_move.xml b/account_payment_batch_process/views/account_move.xml
new file mode 100644
index 00000000000..8e43c2385b3
--- /dev/null
+++ b/account_payment_batch_process/views/account_move.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ account.move.batch.supplier.tree
+ account.move
+
+
+
+
+
+
+
+
+
+
diff --git a/account_payment_batch_process/views/account_payment.xml b/account_payment_batch_process/views/account_payment.xml
new file mode 100644
index 00000000000..e9b53c584cc
--- /dev/null
+++ b/account_payment_batch_process/views/account_payment.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ account.payment.tree.nocreate
+ account.payment
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_payment_batch_process/wizard/__init__.py b/account_payment_batch_process/wizard/__init__.py
new file mode 100644
index 00000000000..f93d6da04de
--- /dev/null
+++ b/account_payment_batch_process/wizard/__init__.py
@@ -0,0 +1,6 @@
+# Copyright (C) 2019, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from . import (
+ account_payment_register,
+ invoice_payment_line,
+)
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
new file mode 100644
index 00000000000..af5c1983c1f
--- /dev/null
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -0,0 +1,461 @@
+# Copyright (C) 2021, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+import logging
+import math
+
+from odoo import _, api, fields, models
+from odoo.exceptions import UserError, ValidationError
+from odoo.tools import float_round
+from odoo.tools.float_utils import float_compare
+
+try:
+ from num2words import num2words
+except ImportError:
+ logging.getLogger(__name__).warning(
+ "The num2words python library is not installed."
+ )
+ num2words = None
+
+
+MAP_INVOICE_TYPE_PARTNER_TYPE = {
+ "out_invoice": "customer",
+ "out_refund": "customer",
+ "in_invoice": "supplier",
+ "in_refund": "supplier",
+}
+
+# Since invoice amounts are unsigned,
+# this is how we know if money comes in or goes out
+MAP_INVOICE_TYPE_PAYMENT_SIGN = {
+ "out_invoice": 1,
+ "in_refund": 1,
+ "in_invoice": -1,
+ "out_refund": -1,
+}
+
+
+class AccountPaymentRegister(models.TransientModel):
+ _inherit = "account.payment.register"
+
+ @api.depends("invoice_payments.amount")
+ def _compute_total(self):
+ self.total_amount = sum(line.amount for line in self.invoice_payments)
+
+ @api.depends("invoice_payments.balance")
+ def _compute_cheque_amount(self):
+ self.cheque_amount = sum(line.balance for line in self.invoice_payments)
+
+ is_auto_fill = fields.Char(string="Auto-Fill Pay Amount")
+ invoice_payments = fields.One2many(
+ "invoice.payment.line", "wizard_id", string="Payments"
+ )
+ is_customer = fields.Boolean(string="Is Customer?")
+ cheque_amount = fields.Float(
+ "Batch Payment Total",
+ required=True,
+ compute="_compute_cheque_amount",
+ store=True,
+ readonly=False,
+ )
+ total_amount = fields.Float("Total Invoices:", compute="_compute_total")
+
+ def get_invoice_payment_line(self, invoice):
+ account = \
+ invoice.invoice_payment_term_id and (
+ (MAP_INVOICE_TYPE_PARTNER_TYPE[invoice.move_type] == "customer") and
+ invoice.invoice_payment_term_id.line_ids[0].discount_income_account_id or
+ invoice.invoice_payment_term_id.line_ids[0].discount_expense_account_id)
+ return (0, 0, {
+ "partner_id": invoice.partner_id.id,
+ "invoice_id": invoice.id,
+ "balance": invoice.amount_residual or 0.0,
+ "amount": invoice.amount_residual or 0.0,
+ "payment_difference": 0.0,
+ "payment_difference_handling": "reconcile",
+ "writeoff_account_id": account.id,
+ "note": "Payment of invoice %s" % invoice.name,
+ })
+
+ def get_invoice_payments(self, invoices):
+ res = []
+ for invoice in invoices:
+ res.append(self.get_invoice_payment_line(invoice))
+ return res
+
+ @api.model
+ def default_get(self, fields_list):
+ if self.env.context and not self.env.context.get("batch", False):
+ return super().default_get(fields_list)
+ res = super().default_get(fields_list)
+ context = dict(self._context or {})
+ active_model = context.get("active_model")
+ active_ids = context.get("active_ids")
+ # Checks on context parameters
+ if not active_model or not active_ids:
+ raise UserError(
+ _(
+ "The wizard is executed without active_model or active_ids in the context."
+ )
+ )
+ if active_model != "account.move":
+ raise UserError(
+ _("The expected model for this action is 'account.move', not '%s'.")
+ % active_model
+ )
+ # Checks on received invoice records
+ invoices = self.env[active_model].browse(active_ids)
+ if any(
+ invoice.state != "posted"
+ or invoice.payment_state not in ["not_paid", "partial"]
+ for invoice in invoices
+ ):
+ raise UserError(_("You can only register payments for open invoices."))
+
+ if any(inv.payment_mode_id != invoices[0].payment_mode_id for inv in invoices):
+ raise UserError(
+ _(
+ "You can only register a batch payment for invoices with the same payment mode."
+ )
+ )
+ if any(
+ MAP_INVOICE_TYPE_PARTNER_TYPE[inv.move_type]
+ != MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type]
+ for inv in invoices
+ ):
+ raise UserError(
+ _(
+ "You cannot mix customer invoices and vendor bills in a single payment."
+ )
+ )
+ if any(inv.currency_id != invoices[0].currency_id for inv in invoices):
+ raise UserError(
+ _(
+ "In order to pay multiple bills at once, they must use the same currency."
+ )
+ )
+
+ if "batch" in context and context.get("batch"):
+ is_customer = (MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type] == "customer")
+ payment_lines = self.get_invoice_payments(invoices)
+ res.update({"invoice_payments": payment_lines, "is_customer": is_customer})
+ else:
+ # Checks on received invoice records
+ if any(
+ MAP_INVOICE_TYPE_PARTNER_TYPE[inv.move_type]
+ != MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type]
+ for inv in invoices
+ ):
+ raise UserError(
+ _(
+ "You cannot mix customer invoices and vendor bills in a single payment."
+ )
+ )
+
+ total_amount = sum(
+ inv.amount_residual * MAP_INVOICE_TYPE_PAYMENT_SIGN[inv.move_type]
+ for inv in invoices
+ )
+ return res.update(
+ {
+ "amount": abs(total_amount),
+ "journal_id": invoices[0].payment_method_id.id,
+ "currency_id": invoices[0].currency_id.id,
+ "payment_type": is_customer and "inbound" or "outbound",
+ "partner_id": invoices[0].commercial_partner_id.id,
+ "partner_type": MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type],
+ "company_id": self.env.user.company_id,
+ "communication": "Batch payment of %s" % fields.Date.today(),
+ }
+ )
+
+ def get_payment_values(self, group_data=None):
+ res = {}
+ if group_data:
+ writeoff_amount = 0
+ writeoff_account_id = False
+ writeoff_name = False
+ for invoice_id in list(group_data["inv_val"]):
+ values = group_data["inv_val"][invoice_id]
+ if not self.currency_id.is_zero(values["payment_difference"]) \
+ and values["payment_difference_handling"] == 'reconcile':
+ writeoff_name = writeoff_name or values["line_name"]
+ writeoff_account_id = writeoff_account_id or values["writeoff_account_id"]
+ writeoff_amount += values["payment_difference"]
+ res = {
+ "journal_id": self.journal_id.id,
+ "payment_method_id": "payment_method_id" in group_data
+ and group_data["payment_method_id"]
+ or self.payment_method_id.id,
+ "date": self.payment_date,
+ "ref": group_data["memo"],
+ "payment_type": self.payment_type,
+ "amount": group_data["total"],
+ "currency_id": self.currency_id.id,
+ "partner_id": int(group_data["partner_id"]),
+ "partner_type": group_data["partner_type"],
+ "check_amount_in_words": group_data["check_amount_in_words"],
+ "write_off_line_vals": {
+ "name": writeoff_name,
+ "account_id": writeoff_account_id,
+ "amount": writeoff_amount,
+ },
+ }
+ return res
+
+ def _check_amounts(self):
+ if float_compare(self.total_amount, self.cheque_amount, 2) != 0:
+ raise ValidationError(
+ _(
+ "The pay amount of the invoices and the batch payment total do not match."
+ )
+ )
+
+ def get_memo(self, memo, group_data, partner_id, data_get):
+ if memo:
+ memo = (
+ group_data[partner_id]["memo"]
+ + " : "
+ + memo
+ + "-"
+ + str(data_get.invoice_id.name)
+ )
+ else:
+ memo = (
+ group_data[partner_id]["memo"] + " : " + str(data_get.invoice_id.name)
+ )
+ return memo
+
+ def total_amount_in_words(self, data_get, old_total=0):
+ check_amount_in_words = num2words(math.floor(old_total + data_get.amount)).title()
+ decimals = (old_total + data_get.amount) % 1
+ if decimals >= 10 ** -2:
+ check_amount_in_words += _(" and %s/100") % str(
+ int(round(float_round(decimals * 100, precision_rounding=1)))
+ )
+ return check_amount_in_words
+
+ def get_payment_invoice_value(self, name, data_get):
+ return {
+ "line_name": name,
+ "amount": data_get.amount,
+ "payment_difference_handling": data_get.payment_difference_handling,
+ "payment_difference": data_get.payment_difference,
+ "writeoff_account_id": data_get.writeoff_account_id
+ and data_get.writeoff_account_id.id
+ or False,
+ }
+
+ def update_group_pay_data(
+ self, partner_id, group_data, data_get, check_amount_in_words
+ ):
+ # build memo value
+ if self.communication:
+ memo = self.communication + "-" + str(data_get.invoice_id.name)
+ else:
+ memo = str(data_get.invoice_id.name)
+ name = ""
+ if data_get.reason_code:
+ name = str(data_get.reason_code.code)
+ if data_get.note:
+ name = name + ": " + str(data_get.note)
+ if not name:
+ name = "Counterpart"
+ inv_val = {
+ "line_name": name,
+ "amount": data_get.amount,
+ "payment_difference_handling": data_get.payment_difference_handling,
+ "payment_difference": data_get.payment_difference,
+ "writeoff_account_id": data_get.writeoff_account_id
+ and data_get.writeoff_account_id.id
+ or False,
+ }
+ group_data.update(
+ {
+ partner_id: {
+ "partner_id": partner_id,
+ "partner_type": MAP_INVOICE_TYPE_PARTNER_TYPE[
+ data_get.invoice_id.move_type
+ ],
+ "total": data_get.amount,
+ "check_amount_in_words": check_amount_in_words,
+ "memo": memo,
+ "temp_invoice": data_get.invoice_id.id,
+ "inv_val": {data_get.invoice_id.id: inv_val},
+ }
+ }
+ )
+
+ def get_amount(self, memo, group_data, line):
+ line.payment_difference = line.balance - line.amount
+ if line.payment_difference_handling:
+ line.invoice_id.discount_taken = line.payment_difference
+ partner_id = line.invoice_id.partner_id.id
+ if partner_id in group_data:
+ old_total = group_data[partner_id]["total"]
+ # build memo value
+ if self.communication:
+ memo = (
+ group_data[partner_id]["memo"]
+ + " : "
+ + self.communication
+ + "-"
+ + str(line.invoice_id.name)
+ )
+ else:
+ memo = (
+ group_data[partner_id]["memo"]
+ + " : "
+ + str(line.invoice_id.name)
+ )
+ # Calculate amount in words
+ check_amount_in_words = self.total_amount_in_words(line, old_total)
+ group_data[partner_id].update(
+ {
+ "partner_id": partner_id,
+ "partner_type": MAP_INVOICE_TYPE_PARTNER_TYPE[
+ line.invoice_id.move_type
+ ],
+ "total": old_total + line.amount,
+ "memo": memo,
+ "temp_invoice": line.invoice_id.id,
+ "check_amount_in_words": check_amount_in_words,
+ }
+ )
+ # prepare name
+ name = ""
+ if line.reason_code:
+ name = str(line.reason_code.code)
+ if line.note:
+ name = name + ": " + str(line.note)
+ if not name:
+ name = "Counterpart"
+ # Update with payment diff data
+ inv_val = self.get_payment_invoice_value(name, line)
+ group_data[partner_id]["inv_val"].update(
+ {line.invoice_id.id: inv_val}
+ )
+ else:
+ # calculate amount in words
+ check_amount_in_words = self.total_amount_in_words(line, 0)
+ # prepare name
+ self.update_group_pay_data(
+ partner_id, group_data, line, check_amount_in_words
+ )
+
+ def make_payments(self):
+ # Make group data either for Customers or Vendors
+ context = dict(self._context or {})
+ group_data = {}
+ memo = self.communication or " "
+ partner_invoices = {}
+ context.update({"is_customer": self.is_customer})
+ self._check_amounts()
+ for invoice_payment_line in self.invoice_payments:
+ if invoice_payment_line.amount > 0:
+ self.get_amount(memo, group_data, invoice_payment_line)
+
+ # update context
+ context.update({"group_data": group_data})
+ # making partner wise payment
+ payment_ids = []
+ for partner in list(group_data):
+ # update active_ids with active invoice id
+ if context.get("active_ids", False) and group_data[partner].get(
+ "inv_val", False
+ ):
+ context.update({"active_ids": list(group_data[partner]["inv_val"])})
+ payment = (
+ self.env["account.payment"]
+ .with_context(context)
+ .create(self.get_payment_values(group_data=group_data[partner]))
+ )
+ payment_ids.append(payment.id)
+ payment.action_post()
+
+ # Reconciliation
+ domain = [
+ ("account_internal_type", "in", ("receivable", "payable")),
+ ("reconciled", "=", False),
+ ]
+ payment_lines = payment.line_ids.filtered_domain(domain)
+ invoices = self.env["account.move"].browse(context.get("active_ids"))
+ lines = invoices.line_ids.filtered_domain(domain)
+ for account in payment_lines.account_id:
+ (payment_lines + lines).filtered_domain(
+ [("account_id", "=", account.id), ("reconciled", "=", False)]
+ ).reconcile()
+
+ view_id = self.env["ir.model.data"].get_object_reference(
+ "account_payment_batch_process",
+ "view_account_payment_tree_nocreate",
+ )[1]
+ return {
+ "name": _("Payments"),
+ "view_type": "form",
+ "view_mode": "tree",
+ "res_model": "account.payment",
+ "view_id": view_id,
+ "type": "ir.actions.act_window",
+ "target": "new",
+ "domain": "[('id','in',%s)]" % (payment_ids),
+ "context": {"group_by": "partner_id"},
+ }
+
+ def get_batch_payment_amount(self, invoice=None, payment_date=None):
+ return {
+ "amount": False,
+ "payment_difference": False,
+ "payment_difference_handling": False,
+ "writeoff_account_id": False,
+ }
+
+ def get_invoice_payments_remaining_amount(self, remaining_amount, count):
+ total = 0.0
+ for payline in self.invoice_payments:
+ vals = self.get_batch_payment_amount(payline.invoice_id, self.payment_date)
+ if remaining_amount < 0.0:
+ break
+ amount = vals.get("amt", False) or payline.balance
+ payline.write(
+ {
+ "amount": vals.get("amount", False) or payline.balance,
+ "payment_difference": vals.get("payment_difference", False) or 0.0,
+ "writeoff_account_id": vals.get("writeoff_account_id", False),
+ "payment_difference_handling": vals.get(
+ "payment_difference_handling", False),
+ "note": vals.get("note", False),
+ }
+ )
+ # Special Case: If full amount payment, then make diff handling as 'reconcile'
+ if payline.payment_difference_handling == "reconcile" and payline.payment_difference == 0.0:
+ # Change handling difference
+ payline.payment_difference_handling = "open"
+ total += amount
+ self.cheque_amount = total
+
+ def auto_fill_payments(self):
+ ctx = self._context.copy()
+ batch_payment = self.cheque_amount
+ remaining_amt = batch_payment
+ count = 0
+ for wizard in self:
+ if wizard.invoice_payments:
+ wizard.get_invoice_payments_remaining_amount(remaining_amt, count)
+ ctx.update(
+ {
+ "reference": wizard.communication or "",
+ "journal_id": wizard.journal_id.id,
+ }
+ )
+ return {
+ "name": _("Batch Payments"),
+ "view_mode": "form",
+ "view_id": False,
+ "view_type": "form",
+ "res_id": self.id,
+ "res_model": "account.payment.register",
+ "type": "ir.actions.act_window",
+ "nodestroy": True,
+ "target": "new",
+ "context": ctx,
+ }
diff --git a/account_payment_batch_process/wizard/account_payment_register.xml b/account_payment_batch_process/wizard/account_payment_register.xml
new file mode 100644
index 00000000000..d42634d74d6
--- /dev/null
+++ b/account_payment_batch_process/wizard/account_payment_register.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+ account.payment.register.wizard.batch.inherited
+
+ account.payment.register
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ context.get('batch', False)
+
+
+
+
+
+ context.get('batch', False)
+
+
+ [('payment_type', '=', payment_type)]
+
+
+
+
+
+
+
+
+
+ Batch Payments
+ ir.actions.act_window
+ account.payment.register
+ form
+
+ {'batch':True, 'active_ids': active_ids}
+ new
+
+
+
+ Batch Payments
+ ir.actions.act_window
+ account.payment.register
+ form
+ new
+
+ list
+ {'batch':True}
+
+
+
diff --git a/account_payment_batch_process/wizard/invoice_payment_line.py b/account_payment_batch_process/wizard/invoice_payment_line.py
new file mode 100644
index 00000000000..401013bf5c2
--- /dev/null
+++ b/account_payment_batch_process/wizard/invoice_payment_line.py
@@ -0,0 +1,103 @@
+# Copyright (C) 2019, Open Source Integrators
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+import logging
+import math
+
+from odoo import _, api, fields, models
+from odoo.exceptions import ValidationError
+from odoo.tools import float_round
+
+try:
+ from num2words import num2words
+except ImportError:
+ logging.getLogger(__name__).warning(
+ "The num2words python library is not installed."
+ )
+ num2words = None
+
+MAP_INVOICE_TYPE_PARTNER_TYPE = {
+ "out_invoice": "customer",
+ "out_refund": "customer",
+ "in_invoice": "supplier",
+ "in_refund": "supplier",
+}
+
+# Since invoice amounts are unsigned,
+# this is how we know if money comes in or goes out
+MAP_INVOICE_TYPE_PAYMENT_SIGN = {
+ "out_invoice": 1,
+ "in_refund": 1,
+ "in_invoice": -1,
+ "out_refund": -1,
+}
+
+
+class InvoicePaymentLine(models.TransientModel):
+ _name = "invoice.payment.line"
+ _description = "Invoice Payment Line"
+ _rec_name = "invoice_id"
+
+ @api.depends("amount")
+ def _compute_payment_difference(self):
+ for rec in self:
+ rec.payment_difference = rec.balance - rec.amount
+
+ invoice_id = fields.Many2one(
+ "account.move", string="Supplier Invoice", required=True
+ )
+ partner_id = fields.Many2one("res.partner", string="Supplier Name", required=True)
+ balance = fields.Float("Balance Amount", required=True)
+ wizard_id = fields.Many2one("account.payment.register", string="Wizard")
+ amount = fields.Float("Amount", required=True)
+ check_amount_in_words = fields.Char(string="Amount in Words")
+ payment_difference = fields.Float(
+ compute="_compute_payment_difference", string="Difference Amount"
+ )
+ payment_difference_handling = fields.Selection(
+ [("open", "Keep open"), ("reconcile", "Mark invoice as fully paid")],
+ default="open",
+ string="Action",
+ copy=False,
+ )
+ writeoff_account_id = fields.Many2one(
+ "account.account",
+ string="Account",
+ domain=[("deprecated", "!=", True)],
+ copy=False,
+ )
+ reason_code = fields.Many2one("payment.adjustment.reason", string="Reason Code")
+ note = fields.Text("Note")
+
+ @api.onchange("amount")
+ def _onchange_amount(self):
+ check_amount_in_words = num2words(
+ math.floor(self.amount), lang="en"
+ ).title()
+ decimals = self.amount % 1
+ if decimals >= 10 ** -2:
+ check_amount_in_words += _(" and %s/100") % str(
+ int(round(float_round(decimals * 100, precision_rounding=1)))
+ )
+ self.check_amount_in_words = check_amount_in_words
+ self.payment_difference = self.balance - self.amount
+
+ @api.onchange("invoice_id")
+ def _onchange_invoice_id(self):
+ """
+ Raise warning while the invoice is changed.
+ """
+ raise ValidationError(_("Invoice is unchangeable!"))
+
+ @api.onchange("partner_id")
+ def _onchange_partner_id(self):
+ """
+ Raise warning while the Customer is changed.
+ """
+ raise ValidationError(_("Partner is unchangeable!"))
+
+ @api.onchange("balance")
+ def _onchange_balance(self):
+ """
+ Raise warning while the Balance Amount is changed.
+ """
+ raise ValidationError(_("Balance is unchangeable!"))
From a0e9c50891632d13b5e2f340e18e129b66784555 Mon Sep 17 00:00:00 2001
From: Maxime Chambreuil
Date: Sat, 13 Mar 2021 01:13:14 -0600
Subject: [PATCH 02/21] [FIX] account_payment_batch_process
---
.../wizard/account_payment_register.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
index af5c1983c1f..44d6d6ad8d6 100644
--- a/account_payment_batch_process/wizard/account_payment_register.py
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -155,18 +155,21 @@ def default_get(self, fields_list):
inv.amount_residual * MAP_INVOICE_TYPE_PAYMENT_SIGN[inv.move_type]
for inv in invoices
)
- return res.update(
+ date_format = self.env['res.lang']._lang_get(self.env.user.lang).date_format
+ communication = "Batch payment of %s" % fields.Date.today().strftime(date_format)
+ res.update(
{
"amount": abs(total_amount),
"journal_id": invoices[0].payment_method_id.id,
"currency_id": invoices[0].currency_id.id,
- "payment_type": is_customer and "inbound" or "outbound",
+ "payment_type": is_customer and "outbound" or "inbound",
"partner_id": invoices[0].commercial_partner_id.id,
"partner_type": MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type],
"company_id": self.env.user.company_id,
- "communication": "Batch payment of %s" % fields.Date.today(),
+ "communication": communication,
}
)
+ return res
def get_payment_values(self, group_data=None):
res = {}
@@ -347,7 +350,6 @@ def make_payments(self):
context = dict(self._context or {})
group_data = {}
memo = self.communication or " "
- partner_invoices = {}
context.update({"is_customer": self.is_customer})
self._check_amounts()
for invoice_payment_line in self.invoice_payments:
@@ -359,7 +361,7 @@ def make_payments(self):
# making partner wise payment
payment_ids = []
for partner in list(group_data):
- # update active_ids with active invoice id
+ # update active_ids with active invoice ids
if context.get("active_ids", False) and group_data[partner].get(
"inv_val", False
):
From a6e79b091d9d9cf9b19887bfd8bb2f1adcd3643a Mon Sep 17 00:00:00 2001
From: Murtuza Saleh
Date: Thu, 10 Jun 2021 16:18:39 +0530
Subject: [PATCH 03/21] [IMP] Improved code.
---
account_payment_batch_process/__manifest__.py | 10 +-
.../views/account_move.xml | 3 +-
.../wizard/account_payment_register.py | 174 ++++++++++++++----
.../wizard/account_payment_register.xml | 16 +-
.../wizard/invoice_payment_line.py | 4 +-
5 files changed, 142 insertions(+), 65 deletions(-)
diff --git a/account_payment_batch_process/__manifest__.py b/account_payment_batch_process/__manifest__.py
index 42d5aaa26c8..f89d422bbe8 100644
--- a/account_payment_batch_process/__manifest__.py
+++ b/account_payment_batch_process/__manifest__.py
@@ -13,19 +13,13 @@
"category": "Extra",
"maintainer": "Open Source Integrators",
"website": "https://github.com/OCA/account-payment",
- "depends": [
- "account",
- "account_check_printing",
- "account_payment_order",
- ],
+ "depends": ["account_check_printing", "account_payment_order"],
"data": [
"security/ir.model.access.csv",
"wizard/account_payment_register.xml",
"views/account_move.xml",
"views/account_payment.xml",
],
- "external_dependencies": {
- "python": ["num2words"],
- },
+ "external_dependencies": {"python": ["num2words"]},
"installable": True,
}
diff --git a/account_payment_batch_process/views/account_move.xml b/account_payment_batch_process/views/account_move.xml
index 8e43c2385b3..2d566148052 100644
--- a/account_payment_batch_process/views/account_move.xml
+++ b/account_payment_batch_process/views/account_move.xml
@@ -6,9 +6,8 @@
account.move
-
-
+
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
index 44d6d6ad8d6..67702048b1d 100644
--- a/account_payment_batch_process/wizard/account_payment_register.py
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -60,21 +60,19 @@ def _compute_cheque_amount(self):
total_amount = fields.Float("Total Invoices:", compute="_compute_total")
def get_invoice_payment_line(self, invoice):
- account = \
- invoice.invoice_payment_term_id and (
- (MAP_INVOICE_TYPE_PARTNER_TYPE[invoice.move_type] == "customer") and
- invoice.invoice_payment_term_id.line_ids[0].discount_income_account_id or
- invoice.invoice_payment_term_id.line_ids[0].discount_expense_account_id)
- return (0, 0, {
- "partner_id": invoice.partner_id.id,
- "invoice_id": invoice.id,
- "balance": invoice.amount_residual or 0.0,
- "amount": invoice.amount_residual or 0.0,
- "payment_difference": 0.0,
- "payment_difference_handling": "reconcile",
- "writeoff_account_id": account.id,
- "note": "Payment of invoice %s" % invoice.name,
- })
+ return (
+ 0,
+ 0,
+ {
+ "partner_id": invoice.partner_id.id,
+ "invoice_id": invoice.id,
+ "balance": invoice.amount_residual or 0.0,
+ "amount": invoice.amount_residual or 0.0,
+ "payment_difference": 0.0,
+ "payment_difference_handling": "reconcile",
+ "note": "Payment of invoice %s" % invoice.name,
+ },
+ )
def get_invoice_payments(self, invoices):
res = []
@@ -114,7 +112,8 @@ def default_get(self, fields_list):
if any(inv.payment_mode_id != invoices[0].payment_mode_id for inv in invoices):
raise UserError(
_(
- "You can only register a batch payment for invoices with the same payment mode."
+ "You can only register a batch payment for"
+ " invoices with the same payment mode."
)
)
if any(
@@ -135,7 +134,9 @@ def default_get(self, fields_list):
)
if "batch" in context and context.get("batch"):
- is_customer = (MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type] == "customer")
+ is_customer = (
+ MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].move_type] == "customer"
+ )
payment_lines = self.get_invoice_payments(invoices)
res.update({"invoice_payments": payment_lines, "is_customer": is_customer})
else:
@@ -155,12 +156,13 @@ def default_get(self, fields_list):
inv.amount_residual * MAP_INVOICE_TYPE_PAYMENT_SIGN[inv.move_type]
for inv in invoices
)
- date_format = self.env['res.lang']._lang_get(self.env.user.lang).date_format
- communication = "Batch payment of %s" % fields.Date.today().strftime(date_format)
+ date_format = self.env["res.lang"]._lang_get(self.env.user.lang).date_format
+ communication = "Batch payment of %s" % fields.Date.today().strftime(
+ date_format
+ )
res.update(
{
"amount": abs(total_amount),
- "journal_id": invoices[0].payment_method_id.id,
"currency_id": invoices[0].currency_id.id,
"payment_type": is_customer and "outbound" or "inbound",
"partner_id": invoices[0].commercial_partner_id.id,
@@ -179,10 +181,15 @@ def get_payment_values(self, group_data=None):
writeoff_name = False
for invoice_id in list(group_data["inv_val"]):
values = group_data["inv_val"][invoice_id]
- if not self.currency_id.is_zero(values["payment_difference"]) \
- and values["payment_difference_handling"] == 'reconcile':
+ if (
+ self.currency_id
+ and not self.currency_id.is_zero(values["payment_difference"])
+ and values["payment_difference_handling"] == "reconcile"
+ ):
writeoff_name = writeoff_name or values["line_name"]
- writeoff_account_id = writeoff_account_id or values["writeoff_account_id"]
+ writeoff_account_id = (
+ writeoff_account_id or values["writeoff_account_id"]
+ )
writeoff_amount += values["payment_difference"]
res = {
"journal_id": self.journal_id.id,
@@ -229,7 +236,9 @@ def get_memo(self, memo, group_data, partner_id, data_get):
return memo
def total_amount_in_words(self, data_get, old_total=0):
- check_amount_in_words = num2words(math.floor(old_total + data_get.amount)).title()
+ check_amount_in_words = num2words(
+ math.floor(old_total + data_get.amount)
+ ).title()
decimals = (old_total + data_get.amount) % 1
if decimals >= 10 ** -2:
check_amount_in_words += _(" and %s/100") % str(
@@ -290,8 +299,6 @@ def update_group_pay_data(
def get_amount(self, memo, group_data, line):
line.payment_difference = line.balance - line.amount
- if line.payment_difference_handling:
- line.invoice_id.discount_taken = line.payment_difference
partner_id = line.invoice_id.partner_id.id
if partner_id in group_data:
old_total = group_data[partner_id]["total"]
@@ -306,9 +313,7 @@ def get_amount(self, memo, group_data, line):
)
else:
memo = (
- group_data[partner_id]["memo"]
- + " : "
- + str(line.invoice_id.name)
+ group_data[partner_id]["memo"] + " : " + str(line.invoice_id.name)
)
# Calculate amount in words
check_amount_in_words = self.total_amount_in_words(line, old_total)
@@ -334,9 +339,7 @@ def get_amount(self, memo, group_data, line):
name = "Counterpart"
# Update with payment diff data
inv_val = self.get_payment_invoice_value(name, line)
- group_data[partner_id]["inv_val"].update(
- {line.invoice_id.id: inv_val}
- )
+ group_data[partner_id]["inv_val"].update({line.invoice_id.id: inv_val})
else:
# calculate amount in words
check_amount_in_words = self.total_amount_in_words(line, 0)
@@ -345,6 +348,39 @@ def get_amount(self, memo, group_data, line):
partner_id, group_data, line, check_amount_in_words
)
+ def _reconcile_open_invoices(
+ self,
+ line,
+ inv,
+ amount_residual,
+ amount_residual_currency,
+ reconciled,
+ amount,
+ debit_amount_currency,
+ credit_amount_currency,
+ ):
+ acc_part_recnc_obj = self.env["account.partial.reconcile"]
+ line.update(
+ {
+ "amount_residual": amount_residual,
+ "amount_residual_currency": amount_residual_currency,
+ "reconciled": reconciled,
+ }
+ )
+ if inv.move_type == "out_invoice":
+ part_rec_domain = [("debit_move_id", "=", line.id)]
+ elif inv.move_type == "in_invoice":
+ part_rec_domain = [("credit_move_id", "=", line.id)]
+ partial = acc_part_recnc_obj.search(part_rec_domain, limit=1)
+ if partial:
+ partial.update(
+ {
+ "amount": amount,
+ "debit_amount_currency": debit_amount_currency,
+ "credit_amount_currency": credit_amount_currency,
+ }
+ )
+
def make_payments(self):
# Make group data either for Customers or Vendors
context = dict(self._context or {})
@@ -355,7 +391,6 @@ def make_payments(self):
for invoice_payment_line in self.invoice_payments:
if invoice_payment_line.amount > 0:
self.get_amount(memo, group_data, invoice_payment_line)
-
# update context
context.update({"group_data": group_data})
# making partner wise payment
@@ -373,7 +408,6 @@ def make_payments(self):
)
payment_ids.append(payment.id)
payment.action_post()
-
# Reconciliation
domain = [
("account_internal_type", "in", ("receivable", "payable")),
@@ -386,6 +420,68 @@ def make_payments(self):
(payment_lines + lines).filtered_domain(
[("account_id", "=", account.id), ("reconciled", "=", False)]
).reconcile()
+ if any(
+ group_data[partner]["inv_val"][inv.id]["payment_difference_handling"]
+ == "open"
+ for inv in invoices
+ ):
+ for inv in invoices:
+ if (
+ group_data[partner]["inv_val"][inv.id][
+ "payment_difference_handling"
+ ]
+ == "open"
+ ):
+ payment_state = "partial"
+ else:
+ payment_state = "paid"
+ for line in inv.line_ids:
+ if line.amount_residual > 0 and payment_state == "paid":
+ line_amount = 0.0
+ partial_amount = group_data[partner]["inv_val"][inv.id][
+ "amount"
+ ]
+ self._reconcile_open_invoices(
+ line,
+ inv,
+ line_amount,
+ line_amount,
+ True,
+ partial_amount,
+ partial_amount,
+ partial_amount,
+ )
+ continue
+ if line.reconciled and payment_state == "partial":
+ line_amount = group_data[partner]["inv_val"][inv.id][
+ "payment_difference"
+ ]
+ partial_amount = group_data[partner]["inv_val"][inv.id][
+ "amount"
+ ]
+ self._reconcile_open_invoices(
+ line,
+ inv,
+ line_amount,
+ line_amount,
+ False,
+ partial_amount,
+ partial_amount,
+ partial_amount,
+ )
+ continue
+ inv.update(
+ {
+ "payment_state": payment_state,
+ "amount_residual": group_data[partner]["inv_val"][inv.id][
+ "payment_difference"
+ ],
+ "amount_residual_signed": group_data[partner]["inv_val"][
+ inv.id
+ ]["payment_difference"],
+ }
+ )
+ inv._compute_payments_widget_reconciled_info()
view_id = self.env["ir.model.data"].get_object_reference(
"account_payment_batch_process",
@@ -418,21 +514,19 @@ def get_invoice_payments_remaining_amount(self, remaining_amount, count):
if remaining_amount < 0.0:
break
amount = vals.get("amt", False) or payline.balance
+ total += amount
payline.write(
{
"amount": vals.get("amount", False) or payline.balance,
"payment_difference": vals.get("payment_difference", False) or 0.0,
"writeoff_account_id": vals.get("writeoff_account_id", False),
"payment_difference_handling": vals.get(
- "payment_difference_handling", False),
+ "payment_difference_handling", False
+ )
+ or "open",
"note": vals.get("note", False),
}
)
- # Special Case: If full amount payment, then make diff handling as 'reconcile'
- if payline.payment_difference_handling == "reconcile" and payline.payment_difference == 0.0:
- # Change handling difference
- payline.payment_difference_handling = "open"
- total += amount
self.cheque_amount = total
def auto_fill_payments(self):
diff --git a/account_payment_batch_process/wizard/account_payment_register.xml b/account_payment_batch_process/wizard/account_payment_register.xml
index d42634d74d6..802cffd739c 100644
--- a/account_payment_batch_process/wizard/account_payment_register.xml
+++ b/account_payment_batch_process/wizard/account_payment_register.xml
@@ -27,11 +27,7 @@
type="object"
class="oe_highlight"
/>
-
+
@@ -64,9 +58,7 @@
-
+
diff --git a/account_payment_batch_process/wizard/invoice_payment_line.py b/account_payment_batch_process/wizard/invoice_payment_line.py
index 401013bf5c2..0200e74c7ba 100644
--- a/account_payment_batch_process/wizard/invoice_payment_line.py
+++ b/account_payment_batch_process/wizard/invoice_payment_line.py
@@ -70,9 +70,7 @@ def _compute_payment_difference(self):
@api.onchange("amount")
def _onchange_amount(self):
- check_amount_in_words = num2words(
- math.floor(self.amount), lang="en"
- ).title()
+ check_amount_in_words = num2words(math.floor(self.amount), lang="en").title()
decimals = self.amount % 1
if decimals >= 10 ** -2:
check_amount_in_words += _(" and %s/100") % str(
From b18966cf620e780dbde46aa03c0682132a8a3774 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Tue, 6 Jul 2021 16:17:40 +0000
Subject: [PATCH 04/21] [UPD] Update account_payment_batch_process.pot
---
.../i18n/account_payment_batch_process.pot | 279 ++++++++++++++++++
1 file changed, 279 insertions(+)
create mode 100644 account_payment_batch_process/i18n/account_payment_batch_process.pot
diff --git a/account_payment_batch_process/i18n/account_payment_batch_process.pot b/account_payment_batch_process/i18n/account_payment_batch_process.pot
new file mode 100644
index 00000000000..d91c5a7f541
--- /dev/null
+++ b/account_payment_batch_process/i18n/account_payment_batch_process.pot
@@ -0,0 +1,279 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_batch_process
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 14.0\n"
+"Report-Msgid-Bugs-To: \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: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#: code:addons/account_payment_batch_process/wizard/invoice_payment_line.py:0
+#, python-format
+msgid " and %s/100"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__writeoff_account_id
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__account_id
+msgid "Account"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__payment_difference_handling
+msgid "Action"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__amount
+msgid "Amount"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__check_amount_in_words
+msgid "Amount in Words"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__is_auto_fill
+#: model_terms:ir.ui.view,arch_db:account_payment_batch_process.view_account_payment_from_invoices_batch_inherited
+msgid "Auto-Fill Pay Amount"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__balance
+msgid "Balance Amount"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/invoice_payment_line.py:0
+#, python-format
+msgid "Balance is unchangeable!"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__cheque_amount
+msgid "Batch Payment Total"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#: model:ir.actions.act_window,name:account_payment_batch_process.action_invoice_batch_process
+#: model:ir.actions.act_window,name:account_payment_batch_process.action_invoice_invoice_batch_process
+#, python-format
+msgid "Batch Payments"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__code
+msgid "Code"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__create_uid
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__create_uid
+msgid "Created by"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__create_date
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__create_date
+msgid "Created on"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model_terms:ir.ui.view,arch_db:account_payment_batch_process.view_account_payment_from_invoices_batch_inherited
+msgid "Customer Invoices Being Paid"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__payment_difference
+msgid "Difference Amount"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__display_name
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__display_name
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__id
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__id
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__id
+msgid "ID"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid ""
+"In order to pay multiple bills at once, they must use the same currency."
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model,name:account_payment_batch_process.model_invoice_payment_line
+msgid "Invoice Payment Line"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/invoice_payment_line.py:0
+#, python-format
+msgid "Invoice is unchangeable!"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__is_customer
+msgid "Is Customer?"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields.selection,name:account_payment_batch_process.selection__invoice_payment_line__payment_difference_handling__open
+msgid "Keep open"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register____last_update
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line____last_update
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason____last_update
+msgid "Last Modified on"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__write_uid
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__write_uid
+msgid "Last Updated by"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__write_date
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__write_date
+msgid "Last Updated on"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model_terms:ir.ui.view,arch_db:account_payment_batch_process.view_account_payment_from_invoices_batch_inherited
+msgid "Make Payments"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields.selection,name:account_payment_batch_process.selection__invoice_payment_line__payment_difference_handling__reconcile
+msgid "Mark invoice as fully paid"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__note
+msgid "Note"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/invoice_payment_line.py:0
+#, python-format
+msgid "Partner is unchangeable!"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model,name:account_payment_batch_process.model_payment_adjustment_reason
+msgid "Payment Adjustment Reason"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__invoice_payments
+#, python-format
+msgid "Payments"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model_terms:ir.ui.view,arch_db:account_payment_batch_process.view_account_payment_from_invoices_batch_inherited
+msgid "Post Difference In"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__reason
+msgid "Reason"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__reason_code
+msgid "Reason Code"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model,name:account_payment_batch_process.model_account_payment_register
+msgid "Register Payment"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__invoice_id
+msgid "Supplier Invoice"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__partner_id
+msgid "Supplier Name"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid "The expected model for this action is 'account.move', not '%s'."
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid ""
+"The pay amount of the invoices and the batch payment total do not match."
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid ""
+"The wizard is executed without active_model or active_ids in the context."
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__total_amount
+msgid "Total Invoices:"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model_terms:ir.ui.view,arch_db:account_payment_batch_process.view_account_payment_from_invoices_batch_inherited
+msgid "Vendor Bills to Pay"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__wizard_id
+msgid "Wizard"
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid ""
+"You can only register a batch payment for invoices with the same payment "
+"mode."
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid "You can only register payments for open invoices."
+msgstr ""
+
+#. module: account_payment_batch_process
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#: code:addons/account_payment_batch_process/wizard/account_payment_register.py:0
+#, python-format
+msgid "You cannot mix customer invoices and vendor bills in a single payment."
+msgstr ""
From 3ac4b81d111fbe29fb53ae201d1f9f12392c43d0 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Tue, 6 Jul 2021 16:21:42 +0000
Subject: [PATCH 05/21] [UPD] README.rst
---
account_payment_batch_process/README.rst | 98 +++-
.../static/description/index.html | 454 ++++++++++++++++++
2 files changed, 541 insertions(+), 11 deletions(-)
create mode 100644 account_payment_batch_process/static/description/index.html
diff --git a/account_payment_batch_process/README.rst b/account_payment_batch_process/README.rst
index 972aab7f7e4..6e5d8db3c79 100644
--- a/account_payment_batch_process/README.rst
+++ b/account_payment_batch_process/README.rst
@@ -1,26 +1,102 @@
-.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
- :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
- :alt: License: AGPL-3
+================================
+Account Payment Batch Processing
+================================
-=============================
-OSI Batch Payments Processing
-=============================
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! This file is generated by oca-gen-addon-readme !!
+ !! changes will be overwritten. !!
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-OSI Batch Payments Processing for Customers Invoices and Supplier Invoices/Vendor Bills.
+.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
+ :target: https://odoo-community.org/page/development-status
+ :alt: Beta
+.. |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%2Faccount--payment-lightgray.png?logo=github
+ :target: https://github.com/OCA/account-payment/tree/14.0/account_payment_batch_process
+ :alt: OCA/account-payment
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+ :target: https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-0-account_payment_batch_process
+ :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+ :target: https://runbot.odoo-community.org/runbot/96/14.0
+ :alt: Try me on Runbot
-Payments to multiple vendors can be processed.
-Payments from multiple customers can be processed.
+|badge1| |badge2| |badge3| |badge4| |badge5|
+
+Batch Payments Processing for Customers Invoices and Supplier Invoices/Vendor Bills.
+
+Payments to multiple vendors can be processed. Payments from multiple customers can be processed.
Partial payments can be processed leaving invoice/bill open or writing off unpaid portion to a write-off account.
+**Table of contents**
+
+.. contents::
+ :local:
+
+Changelog
+=========
+
+12.0.1.1.0
+~~~~~~~~~~
+
+**Features**
+
+- Remove menu "Batch Payments" from Vendors and Customers
+- Remove menu "Register Payment" from batch invoices.
+
+12.0.1.0.0
+~~~~~~~~~~
+
+- Initial File
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub 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
+`feedback `_.
+
+Do not contact contributors directly about support or help with technical issues.
+
Credits
=======
-* Open Source Integrators
+
+Authors
+~~~~~~~
+
+* Open Source Integrators
Contributors
-============
+~~~~~~~~~~~~
+
* Balaji Kannan
* Bhavesh Odedra
* Mayank Gosai
* Sandip Mangukiya
* Hardik Suthar
+
+Other credits
+~~~~~~~~~~~~~
+
+* Open Source Integrators
+
+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/account-payment `_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_payment_batch_process/static/description/index.html b/account_payment_batch_process/static/description/index.html
new file mode 100644
index 00000000000..64141633386
--- /dev/null
+++ b/account_payment_batch_process/static/description/index.html
@@ -0,0 +1,454 @@
+
+
+
+
+
+
+Account Payment Batch Processing
+
+
+
+
+
Account Payment Batch Processing
+
+
+
+
Batch Payments Processing for Customers Invoices and Supplier Invoices/Vendor Bills.
+
Payments to multiple vendors can be processed. Payments from multiple customers can be processed.
+
Partial payments can be processed leaving invoice/bill open or writing off unpaid portion to a write-off account.
+
Table of contents
+
+
+
+
+
+
Features
+
+Remove menu “Batch Payments” from Vendors and Customers
+Remove menu “Register Payment” from batch invoices.
+
+
+
+
+
+
+
Bugs are tracked on GitHub 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
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+Open Source Integrators
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
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/account-payment project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
From f36e8ffd083cd64d0a5762f79b060812710dc89e Mon Sep 17 00:00:00 2001
From: oca-git-bot
Date: Wed, 30 Mar 2022 21:44:02 +0200
Subject: [PATCH 06/21] [IMP] update dotfiles [ci skip]
---
.../wizard/account_payment_register.py | 2 +-
account_payment_batch_process/wizard/invoice_payment_line.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
index 67702048b1d..21f2c06465d 100644
--- a/account_payment_batch_process/wizard/account_payment_register.py
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -240,7 +240,7 @@ def total_amount_in_words(self, data_get, old_total=0):
math.floor(old_total + data_get.amount)
).title()
decimals = (old_total + data_get.amount) % 1
- if decimals >= 10 ** -2:
+ if decimals >= 10**-2:
check_amount_in_words += _(" and %s/100") % str(
int(round(float_round(decimals * 100, precision_rounding=1)))
)
diff --git a/account_payment_batch_process/wizard/invoice_payment_line.py b/account_payment_batch_process/wizard/invoice_payment_line.py
index 0200e74c7ba..11fe3872d4a 100644
--- a/account_payment_batch_process/wizard/invoice_payment_line.py
+++ b/account_payment_batch_process/wizard/invoice_payment_line.py
@@ -72,7 +72,7 @@ def _compute_payment_difference(self):
def _onchange_amount(self):
check_amount_in_words = num2words(math.floor(self.amount), lang="en").title()
decimals = self.amount % 1
- if decimals >= 10 ** -2:
+ if decimals >= 10**-2:
check_amount_in_words += _(" and %s/100") % str(
int(round(float_round(decimals * 100, precision_rounding=1)))
)
From 5e7b523ef653f4dc963d6a83026e029d2864732f Mon Sep 17 00:00:00 2001
From: Denis Leemann
Date: Tue, 30 Aug 2022 15:39:55 +0200
Subject: [PATCH 07/21] [IMP] account_payment_batch_process: black, isort,
prettier
---
.../models/payment_adjustment_reason.py | 6 +++---
.../wizard/account_payment_register.py | 2 +-
.../wizard/invoice_payment_line.py | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/account_payment_batch_process/models/payment_adjustment_reason.py b/account_payment_batch_process/models/payment_adjustment_reason.py
index d4c77876145..6773d83a4fb 100644
--- a/account_payment_batch_process/models/payment_adjustment_reason.py
+++ b/account_payment_batch_process/models/payment_adjustment_reason.py
@@ -9,9 +9,9 @@ class PaymentAdjustmentReason(models.Model):
_rec_name = "code"
_description = "Payment Adjustment Reason"
- code = fields.Char(string="Code", required=True, copy=False)
- account_id = fields.Many2one("account.account", string="Account")
- reason = fields.Text(string="Reason", copy=False)
+ code = fields.Char(required=True, copy=False)
+ account_id = fields.Many2one("account.account")
+ reason = fields.Text(copy=False)
def name_get(self):
result = []
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
index 21f2c06465d..6e47e16e8fc 100644
--- a/account_payment_batch_process/wizard/account_payment_register.py
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -402,7 +402,7 @@ def make_payments(self):
):
context.update({"active_ids": list(group_data[partner]["inv_val"])})
payment = (
- self.env["account.payment"]
+ self.env["account.payment"] # pylint: disable=context-overridden
.with_context(context)
.create(self.get_payment_values(group_data=group_data[partner]))
)
diff --git a/account_payment_batch_process/wizard/invoice_payment_line.py b/account_payment_batch_process/wizard/invoice_payment_line.py
index 11fe3872d4a..38690a911b0 100644
--- a/account_payment_batch_process/wizard/invoice_payment_line.py
+++ b/account_payment_batch_process/wizard/invoice_payment_line.py
@@ -48,7 +48,7 @@ def _compute_payment_difference(self):
partner_id = fields.Many2one("res.partner", string="Supplier Name", required=True)
balance = fields.Float("Balance Amount", required=True)
wizard_id = fields.Many2one("account.payment.register", string="Wizard")
- amount = fields.Float("Amount", required=True)
+ amount = fields.Float(required=True)
check_amount_in_words = fields.Char(string="Amount in Words")
payment_difference = fields.Float(
compute="_compute_payment_difference", string="Difference Amount"
@@ -65,8 +65,8 @@ def _compute_payment_difference(self):
domain=[("deprecated", "!=", True)],
copy=False,
)
- reason_code = fields.Many2one("payment.adjustment.reason", string="Reason Code")
- note = fields.Text("Note")
+ reason_code = fields.Many2one("payment.adjustment.reason")
+ note = fields.Text()
@api.onchange("amount")
def _onchange_amount(self):
From adce4d2c2b7e2bb26dc6a96271aaa4dcc36f0fe1 Mon Sep 17 00:00:00 2001
From: Denis Leemann
Date: Tue, 30 Aug 2022 15:41:47 +0200
Subject: [PATCH 08/21] [MIG] account_payment_batch_process: Migration to 15.0
---
account_payment_batch_process/__manifest__.py | 2 +-
account_payment_batch_process/readme/CONTRIBUTORS.rst | 3 +++
.../wizard/account_payment_register.py | 6 +++---
.../wizard/account_payment_register.xml | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/account_payment_batch_process/__manifest__.py b/account_payment_batch_process/__manifest__.py
index f89d422bbe8..fb42f1fe446 100644
--- a/account_payment_batch_process/__manifest__.py
+++ b/account_payment_batch_process/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Account Payment Batch Processing",
- "version": "14.0.1.0.0",
+ "version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"summary": """
diff --git a/account_payment_batch_process/readme/CONTRIBUTORS.rst b/account_payment_batch_process/readme/CONTRIBUTORS.rst
index a8e8821e4a7..2d5d32674bb 100644
--- a/account_payment_batch_process/readme/CONTRIBUTORS.rst
+++ b/account_payment_batch_process/readme/CONTRIBUTORS.rst
@@ -3,3 +3,6 @@
* Mayank Gosai
* Sandip Mangukiya
* Hardik Suthar
+
+* Camptocamp
+ * Denis Leemann
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
index 6e47e16e8fc..9c4a12408a3 100644
--- a/account_payment_batch_process/wizard/account_payment_register.py
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -193,9 +193,9 @@ def get_payment_values(self, group_data=None):
writeoff_amount += values["payment_difference"]
res = {
"journal_id": self.journal_id.id,
- "payment_method_id": "payment_method_id" in group_data
- and group_data["payment_method_id"]
- or self.payment_method_id.id,
+ "payment_method_line_id": "payment_method_line_id" in group_data
+ and group_data["payment_method_line_id"]
+ or self.payment_method_line_id.id,
"date": self.payment_date,
"ref": group_data["memo"],
"payment_type": self.payment_type,
diff --git a/account_payment_batch_process/wizard/account_payment_register.xml b/account_payment_batch_process/wizard/account_payment_register.xml
index 802cffd739c..7148e1a6ce0 100644
--- a/account_payment_batch_process/wizard/account_payment_register.xml
+++ b/account_payment_batch_process/wizard/account_payment_register.xml
@@ -83,7 +83,7 @@
context.get('batch', False)
-
+
[('payment_type', '=', payment_type)]
From eddbb510a03ce10f9c797e9764ad228c9fc7d123 Mon Sep 17 00:00:00 2001
From: cyrilmanuel
Date: Mon, 3 Oct 2022 13:32:41 +0200
Subject: [PATCH 09/21] Fix: Retrieve correct View id in make_payment wizzard
---
.../wizard/account_payment_register.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/account_payment_batch_process/wizard/account_payment_register.py b/account_payment_batch_process/wizard/account_payment_register.py
index 9c4a12408a3..ec9f3151cb5 100644
--- a/account_payment_batch_process/wizard/account_payment_register.py
+++ b/account_payment_batch_process/wizard/account_payment_register.py
@@ -482,11 +482,9 @@ def make_payments(self):
}
)
inv._compute_payments_widget_reconciled_info()
-
- view_id = self.env["ir.model.data"].get_object_reference(
- "account_payment_batch_process",
- "view_account_payment_tree_nocreate",
- )[1]
+ view_id = self.env.ref(
+ "account_payment_batch_process.view_account_payment_tree_nocreate"
+ ).id
return {
"name": _("Payments"),
"view_type": "form",
From ef0d3527b03332e338378b3e30d2688e25874c9c Mon Sep 17 00:00:00 2001
From: oca-ci
Date: Thu, 20 Oct 2022 08:44:53 +0000
Subject: [PATCH 10/21] [UPD] Update account_payment_batch_process.pot
---
.../i18n/account_payment_batch_process.pot | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/account_payment_batch_process/i18n/account_payment_batch_process.pot b/account_payment_batch_process/i18n/account_payment_batch_process.pot
index d91c5a7f541..d9b2ad1b067 100644
--- a/account_payment_batch_process/i18n/account_payment_batch_process.pot
+++ b/account_payment_batch_process/i18n/account_payment_batch_process.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -99,14 +99,12 @@ msgid "Difference Amount"
msgstr ""
#. module: account_payment_batch_process
-#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__display_name
#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__display_name
#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__display_name
msgid "Display Name"
msgstr ""
#. module: account_payment_batch_process
-#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register__id
#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line__id
#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason__id
msgid "ID"
@@ -141,7 +139,6 @@ msgid "Keep open"
msgstr ""
#. module: account_payment_batch_process
-#: model:ir.model.fields,field_description:account_payment_batch_process.field_account_payment_register____last_update
#: model:ir.model.fields,field_description:account_payment_batch_process.field_invoice_payment_line____last_update
#: model:ir.model.fields,field_description:account_payment_batch_process.field_payment_adjustment_reason____last_update
msgid "Last Modified on"
From 6b19055d32ee2d4b03909768d8007fad5deeeaf3 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 20 Oct 2022 08:48:47 +0000
Subject: [PATCH 11/21] [UPD] README.rst
---
account_payment_batch_process/README.rst | 13 ++++++++-----
.../static/description/index.html | 8 +++++---
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/account_payment_batch_process/README.rst b/account_payment_batch_process/README.rst
index 6e5d8db3c79..e41da0ceb43 100644
--- a/account_payment_batch_process/README.rst
+++ b/account_payment_batch_process/README.rst
@@ -14,13 +14,13 @@ Account Payment Batch Processing
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github
- :target: https://github.com/OCA/account-payment/tree/14.0/account_payment_batch_process
+ :target: https://github.com/OCA/account-payment/tree/15.0/account_payment_batch_process
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-0-account_payment_batch_process
+ :target: https://translation.odoo-community.org/projects/account-payment-15-0/account-payment-15-0-account_payment_batch_process
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/96/14.0
+ :target: https://runbot.odoo-community.org/runbot/96/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -58,7 +58,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -79,6 +79,9 @@ Contributors
* Sandip Mangukiya
* Hardik Suthar
+* Camptocamp
+ * Denis Leemann
+
Other credits
~~~~~~~~~~~~~
@@ -97,6 +100,6 @@ 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/account-payment `_ project on GitHub.
+This module is part of the `OCA/account-payment `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_payment_batch_process/static/description/index.html b/account_payment_batch_process/static/description/index.html
index 64141633386..ba591662d84 100644
--- a/account_payment_batch_process/static/description/index.html
+++ b/account_payment_batch_process/static/description/index.html
@@ -367,7 +367,7 @@ Account Payment Batch Processing
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
Batch Payments Processing for Customers Invoices and Supplier Invoices/Vendor Bills.
Payments to multiple vendors can be processed. Payments from multiple customers can be processed.
Partial payments can be processed leaving invoice/bill open or writing off unpaid portion to a write-off account.
@@ -411,7 +411,7 @@
Bugs are tracked on GitHub 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
-feedback .
+feedback .
Do not contact contributors directly about support or help with technical issues.
@@ -445,7 +447,7 @@
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/account-payment project on GitHub.
+
This module is part of the OCA/account-payment project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
From 1a0a10593606b89f066eed722fde6ea76166f8af Mon Sep 17 00:00:00 2001
From: Murtaza Mithaiwala
Date: Mon, 26 Dec 2022 15:39:45 +0530
Subject: [PATCH 12/21] [16.0][MIG] account_payment_batch_process
---
account_payment_batch_process/README.rst | 10 +++++-----
account_payment_batch_process/__manifest__.py | 2 +-
.../static/description/index.html | 8 ++++----
.../views/account_move.xml | 2 +-
.../wizard/account_payment_register.py | 20 +++++++++++++------
requirements.txt | 2 ++
.../odoo/addons/account_payment_batch_process | 1 +
setup/account_payment_batch_process/setup.py | 6 ++++++
8 files changed, 34 insertions(+), 17 deletions(-)
create mode 100644 requirements.txt
create mode 120000 setup/account_payment_batch_process/odoo/addons/account_payment_batch_process
create mode 100644 setup/account_payment_batch_process/setup.py
diff --git a/account_payment_batch_process/README.rst b/account_payment_batch_process/README.rst
index e41da0ceb43..7558d0ddc81 100644
--- a/account_payment_batch_process/README.rst
+++ b/account_payment_batch_process/README.rst
@@ -14,13 +14,13 @@ Account Payment Batch Processing
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github
- :target: https://github.com/OCA/account-payment/tree/15.0/account_payment_batch_process
+ :target: https://github.com/OCA/account-payment/tree/16.0/account_payment_batch_process
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/account-payment-15-0/account-payment-15-0-account_payment_batch_process
+ :target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_payment_batch_process
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/96/15.0
+ :target: https://runbot.odoo-community.org/runbot/96/16.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -58,7 +58,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -100,6 +100,6 @@ 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/account-payment `_ project on GitHub.
+This module is part of the `OCA/account-payment `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_payment_batch_process/__manifest__.py b/account_payment_batch_process/__manifest__.py
index fb42f1fe446..f95428acaf6 100644
--- a/account_payment_batch_process/__manifest__.py
+++ b/account_payment_batch_process/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Account Payment Batch Processing",
- "version": "15.0.1.0.0",
+ "version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"summary": """
diff --git a/account_payment_batch_process/static/description/index.html b/account_payment_batch_process/static/description/index.html
index ba591662d84..90309632911 100644
--- a/account_payment_batch_process/static/description/index.html
+++ b/account_payment_batch_process/static/description/index.html
@@ -3,7 +3,7 @@
-
+
Account Payment Batch Processing
+
+
+
+
Discount on batch payments
+
+
+
+
This module allows you to define discounts for early payment and apply them on batch
+payments.
+
Table of contents
+
+
+
+
+Go to Accounting > Invoicing > Payment Terms
+Select or create a payment term
+Check the box “Early discount payment”
+Exclude the shipping and/or the tax amount
+Create a line with a discount for early payment, like 2% if paid within 15 days
+
+
+
+
+
+Go to Accounting > Customers > Invoices or Accounting > Vendors > Bills
+Select various open invoices or bills
+Go to the Action menu
+Select Batch Payments
+Adjust the information
+Click on Make Payments
+
+
+
+
+
Bugs are tracked on GitHub 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
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+Open Source Integrators
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
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.
+
Current maintainer :
+
+
This module is part of the OCA/account-payment project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
From 187dc44ff7fe70c873611815dec4468f194b7c0c Mon Sep 17 00:00:00 2001
From: Murtaza Mithaiwala
Date: Wed, 8 Dec 2021 17:48:52 +0530
Subject: [PATCH 16/21] [14.0][FIX] account_payment_batch_process_discount.
---
.../models/account_payment_term_line.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/account_payment_batch_process_discount/models/account_payment_term_line.py b/account_payment_batch_process_discount/models/account_payment_term_line.py
index 419a4ebd0c4..9494e6eec81 100644
--- a/account_payment_batch_process_discount/models/account_payment_term_line.py
+++ b/account_payment_batch_process_discount/models/account_payment_term_line.py
@@ -17,7 +17,7 @@ def write(self, vals):
invoice_ids = self.env["account.move"].search(
[
("state", "=", "posted"),
- ("payment_term_id", "=", item.payment_id.id),
+ ("invoice_payment_term_id", "=", item.payment_id.id),
]
)
for inv in invoice_ids:
From 29998becbc01341b7880e7bbc86277676c6fcd56 Mon Sep 17 00:00:00 2001
From: Sandip Mangukiya
Date: Wed, 2 Mar 2022 15:01:07 -0700
Subject: [PATCH 17/21] [FIX]wrong field name
---
.../models/account_payment_term_line.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/account_payment_batch_process_discount/models/account_payment_term_line.py b/account_payment_batch_process_discount/models/account_payment_term_line.py
index 9494e6eec81..86a2813819a 100644
--- a/account_payment_batch_process_discount/models/account_payment_term_line.py
+++ b/account_payment_batch_process_discount/models/account_payment_term_line.py
@@ -22,7 +22,7 @@ def write(self, vals):
)
for inv in invoice_ids:
# Check payment date discount validation
- invoice_date = fields.Date.from_string(inv.date_invoice)
+ invoice_date = fields.Date.from_string(inv.invoice_date)
# Update discount validity days
for line in inv.invoice_payment_term_id.line_ids:
inv.valid_discount_date = invoice_date + relativedelta(
From a5c0489fbe96b00b41b154fac18841b666577274 Mon Sep 17 00:00:00 2001
From: Sandip Mangukiya
Date: Tue, 8 Mar 2022 11:00:49 -0700
Subject: [PATCH 18/21] Update account_payment_term_line.py
---
.../models/account_payment_term_line.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/account_payment_batch_process_discount/models/account_payment_term_line.py b/account_payment_batch_process_discount/models/account_payment_term_line.py
index 86a2813819a..b1da878128d 100644
--- a/account_payment_batch_process_discount/models/account_payment_term_line.py
+++ b/account_payment_batch_process_discount/models/account_payment_term_line.py
@@ -25,7 +25,7 @@ def write(self, vals):
invoice_date = fields.Date.from_string(inv.invoice_date)
# Update discount validity days
for line in inv.invoice_payment_term_id.line_ids:
- inv.valid_discount_date = invoice_date + relativedelta(
+ inv.discount_date = invoice_date + relativedelta(
days=line.discount_days
)
return res
From b61a0f4e9599e1f964a36db2f6c8898bf88226b8 Mon Sep 17 00:00:00 2001
From: Hardik-OSI
Date: Wed, 10 Aug 2022 23:49:08 +0530
Subject: [PATCH 19/21] [14.0][FIX] Discount on non Round Amount not getting
Proper
---
.../wizard/invoice_payment_line.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/account_payment_batch_process_discount/wizard/invoice_payment_line.py b/account_payment_batch_process_discount/wizard/invoice_payment_line.py
index caedeabaf8d..d9c1b81cd74 100644
--- a/account_payment_batch_process_discount/wizard/invoice_payment_line.py
+++ b/account_payment_batch_process_discount/wizard/invoice_payment_line.py
@@ -45,7 +45,7 @@ def onchange_amount(self):
due_or_balance = rec.balance - rec.amount
# apply discount
- if due_or_balance <= discount_amount:
+ if round(due_or_balance, 2) <= discount_amount:
overpayment = discount_amount - due_or_balance
rec.payment_difference = discount_amount - overpayment
rec.payment_difference_handling = "reconcile"
From 83e02b3c0aa2923e07e5328afa816515b336b33a Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 11 Aug 2022 21:19:05 +0000
Subject: [PATCH 20/21] account_payment_batch_process_discount 14.0.1.0.1
---
account_payment_batch_process_discount/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/account_payment_batch_process_discount/__manifest__.py b/account_payment_batch_process_discount/__manifest__.py
index ed321a41adc..9ba9027c0a0 100644
--- a/account_payment_batch_process_discount/__manifest__.py
+++ b/account_payment_batch_process_discount/__manifest__.py
@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Discount on batch payments",
- "version": "14.0.1.0.0",
+ "version": "14.0.1.0.1",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Accounting & Finance",
From e1502056320f960a3d307a3448643355399a2d18 Mon Sep 17 00:00:00 2001
From: Murtaza Mithaiwala
Date: Mon, 26 Dec 2022 15:56:42 +0530
Subject: [PATCH 21/21] [16.0][MIG] account_payment_batch_process_discount
---
account_payment_batch_process_discount/README.rst | 13 ++++++++-----
.../__manifest__.py | 2 +-
.../models/account_move.py | 2 +-
.../readme/CONTRIBUTORS.rst | 3 +++
.../static/description/index.html | 10 ++++++----
.../addons/account_payment_batch_process_discount | 1 +
.../account_payment_batch_process_discount/setup.py | 6 ++++++
7 files changed, 26 insertions(+), 11 deletions(-)
create mode 120000 setup/account_payment_batch_process_discount/odoo/addons/account_payment_batch_process_discount
create mode 100644 setup/account_payment_batch_process_discount/setup.py
diff --git a/account_payment_batch_process_discount/README.rst b/account_payment_batch_process_discount/README.rst
index 9b4000205c6..eeb55f20236 100644
--- a/account_payment_batch_process_discount/README.rst
+++ b/account_payment_batch_process_discount/README.rst
@@ -14,13 +14,13 @@ Discount on batch payments
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github
- :target: https://github.com/OCA/account-payment/tree/14.0/account_payment_batch_process_discount
+ :target: https://github.com/OCA/account-payment/tree/16.0/account_payment_batch_process_discount
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-0-account_payment_batch_process_discount
+ :target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_payment_batch_process_discount
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/96/14.0
+ :target: https://runbot.odoo-community.org/runbot/96/16.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -58,7 +58,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -79,6 +79,9 @@ Contributors
* Balaji Kannan
* Maxime Chambreuil
+* Camptocamp
+ * Denis Leemann
+
Maintainers
~~~~~~~~~~~
@@ -100,6 +103,6 @@ Current `maintainer `__:
|maintainer-mgosai|
-This module is part of the `OCA/account-payment `_ project on GitHub.
+This module is part of the `OCA/account-payment `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_payment_batch_process_discount/__manifest__.py b/account_payment_batch_process_discount/__manifest__.py
index 9ba9027c0a0..bbb54402b0c 100644
--- a/account_payment_batch_process_discount/__manifest__.py
+++ b/account_payment_batch_process_discount/__manifest__.py
@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Discount on batch payments",
- "version": "14.0.1.0.1",
+ "version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Accounting & Finance",
diff --git a/account_payment_batch_process_discount/models/account_move.py b/account_payment_batch_process_discount/models/account_move.py
index d30111d7fa9..e9758bee30a 100644
--- a/account_payment_batch_process_discount/models/account_move.py
+++ b/account_payment_batch_process_discount/models/account_move.py
@@ -8,7 +8,7 @@
class AccountMove(models.Model):
_inherit = "account.move"
- valid_discount_date = fields.Date(string="Valid Discount Date")
+ valid_discount_date = fields.Date()
def action_post(self):
res = super().action_post()
diff --git a/account_payment_batch_process_discount/readme/CONTRIBUTORS.rst b/account_payment_batch_process_discount/readme/CONTRIBUTORS.rst
index 7a8d15d319c..125f394a6c1 100644
--- a/account_payment_batch_process_discount/readme/CONTRIBUTORS.rst
+++ b/account_payment_batch_process_discount/readme/CONTRIBUTORS.rst
@@ -3,3 +3,6 @@
* Mayank Gosai
* Balaji Kannan
* Maxime Chambreuil
+
+* Camptocamp
+ * Denis Leemann
diff --git a/account_payment_batch_process_discount/static/description/index.html b/account_payment_batch_process_discount/static/description/index.html
index 003509b3fd2..8705baccbd0 100644
--- a/account_payment_batch_process_discount/static/description/index.html
+++ b/account_payment_batch_process_discount/static/description/index.html
@@ -3,7 +3,7 @@
-
+
Discount on batch payments