mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_payment_order: Add Transfer moves dates
In v13 the existing behavior was defined with today's date the Transfer Move, therefore, we define that behavior by default without configuration since it is the expected behavior. https://github.com/OCA/bank-payment/pull/805/files TT49582
This commit is contained in:
@@ -1386,259 +1386,3 @@ msgstr "el"
|
||||
msgid "otherwise, new payment orders will be created (one per payment mode)."
|
||||
msgstr ""
|
||||
"En caso contrario, se crearán nuevas órdenes (una por cada modo de pago)."
|
||||
|
||||
#, python-format
|
||||
#~ msgid "<b>Account Number</b>: %s - <b>Partner</b>: %s"
|
||||
#~ msgstr "<b>Número de cuenta</b>: %s - <b>Empresa</b>: %s"
|
||||
|
||||
#, python-format
|
||||
#~ msgid ""
|
||||
#~ "No handler for this payment method. Maybe you haven't installed the "
|
||||
#~ "related Odoo module."
|
||||
#~ msgstr ""
|
||||
#~ "Sin manejador para este método de pago. Tal vez no ha instalado el módulo "
|
||||
#~ "de Odoo relacionado."
|
||||
|
||||
#~ msgid "SMS Delivery error"
|
||||
#~ msgstr "Error de entrega del SMS"
|
||||
|
||||
#~ msgid "Number of messages which requires an action"
|
||||
#~ msgstr "Número de mensajes que requieren una acción"
|
||||
|
||||
#, python-format
|
||||
#~ msgid ""
|
||||
#~ "No Payment Line created for invoice %s because it already exists or "
|
||||
#~ "because this invoice is already paid."
|
||||
#~ msgstr ""
|
||||
#~ "No se ha creado línea de pago para la factura %s porque ya existe o "
|
||||
#~ "porque la factura ya está pagada."
|
||||
|
||||
#~ msgid "Accounting Entries Options"
|
||||
#~ msgstr "Opciones de asientos contables"
|
||||
|
||||
#~ msgid "Bank Payment Line"
|
||||
#~ msgstr "Línea de pago bancario"
|
||||
|
||||
#~ msgid "Bank Payment Line Ref"
|
||||
#~ msgstr "Ref. de la línea de pago bancario"
|
||||
|
||||
#~ msgid "Bank Payment Lines"
|
||||
#~ msgstr "Líneas de pago bancario"
|
||||
|
||||
#, python-format
|
||||
#~ msgid "Debit bank line %s"
|
||||
#~ msgstr "Línea de adeudo de banco %s"
|
||||
|
||||
#, python-format
|
||||
#~ msgid "Debit order %s"
|
||||
#~ msgstr "Orden de cobro %s"
|
||||
|
||||
#~ msgid "Generate Accounting Entries On File Upload"
|
||||
#~ msgstr "Generar asientos contables al subir el archivo"
|
||||
|
||||
#~ msgid "Move Option"
|
||||
#~ msgstr "Opciones de asiento"
|
||||
|
||||
#~ msgid "Number of unread messages"
|
||||
#~ msgstr "Número de mensajes sin leer"
|
||||
|
||||
#, python-format
|
||||
#~ msgid ""
|
||||
#~ "On the payment mode '%s', you must choose an option for the 'Move Option' "
|
||||
#~ "parameter."
|
||||
#~ msgstr ""
|
||||
#~ "En el modo de pago '%s', debe escoger una opción para las 'Opciones de "
|
||||
#~ "asiento'."
|
||||
|
||||
#~ msgid "One move per payment date"
|
||||
#~ msgstr "Un asiento por fecha de pago"
|
||||
|
||||
#~ msgid "One move per payment line"
|
||||
#~ msgstr "Un asiento por línea de pago"
|
||||
|
||||
#~ msgid "Order"
|
||||
#~ msgstr "Orden"
|
||||
|
||||
#, python-format
|
||||
#~ msgid "Payment bank line %s"
|
||||
#~ msgstr "Línea de pago bancario %s"
|
||||
|
||||
#, python-format
|
||||
#~ msgid "Payment order %s"
|
||||
#~ msgstr "Orden %s"
|
||||
|
||||
#~ msgid "Post Move"
|
||||
#~ msgstr "Publicar movimiento"
|
||||
|
||||
#~ msgid "Related Payment Lines"
|
||||
#~ msgstr "Líneas de pago relacionadas"
|
||||
|
||||
#~ msgid "Search Bank Payment Lines"
|
||||
#~ msgstr "Buscar líneas de pago bancario"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "The bank payment lines are used to generate the payment file. They are "
|
||||
#~ "automatically created from transaction lines upon confirmation of the "
|
||||
#~ "payment order: one bank payment line can group several transaction lines "
|
||||
#~ "if the option 'Group Transactions in Payment Orders' is active on the "
|
||||
#~ "payment mode."
|
||||
#~ msgstr ""
|
||||
#~ "Las líneas de pago bancarias se usan para generar el archivo de pago. Se "
|
||||
#~ "crean automáticamente de las líneas de transacciones en la confirmación "
|
||||
#~ "de la orden: una línea de pago bancario puede agrupar varias líneas de "
|
||||
#~ "transacción si la opción 'Agrupar transacciones en las órdenes' está "
|
||||
#~ "activada en el modo de pago."
|
||||
|
||||
#~ msgid "Total Amount"
|
||||
#~ msgstr "Importe total"
|
||||
|
||||
#~ msgid "Unread Messages"
|
||||
#~ msgstr "Mensajes sin leer"
|
||||
|
||||
#~ msgid "Unread Messages Counter"
|
||||
#~ msgstr "Contador de mensajes sin leer"
|
||||
|
||||
#~ msgid "%d payment lines added to the existing draft payment order %s."
|
||||
#~ msgstr "%d líneas de pago añadidas a la orden de pago en borrador %s."
|
||||
|
||||
#~ msgid ""
|
||||
#~ "%d payment lines added to the new draft payment order %s which has been "
|
||||
#~ "automatically created."
|
||||
#~ msgstr ""
|
||||
#~ "%d líneas de pago añadidas a una nueva orden de pago en borrador %s que "
|
||||
#~ "ha sido creada automáticamente."
|
||||
|
||||
#~ msgid ""
|
||||
#~ "A valid BIC contains 8 or 11 characters. The BIC '%s' contains %d "
|
||||
#~ "characters, so it is not valid."
|
||||
#~ msgstr ""
|
||||
#~ "Un BIC válido contiene 8 u 11 caracteres. El BIC '%s' contiene %d "
|
||||
#~ "caracteres, por lo que no es válido."
|
||||
|
||||
#~ msgid "Can not reconcile: no move line for payment line %s of partner '%s'."
|
||||
#~ msgstr ""
|
||||
#~ "No se puede conciliar: no hay apunte para la línea de pago %s de la "
|
||||
#~ "empresa '%s'."
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Cannot delete a payment order line whose payment order is in state '%s'. "
|
||||
#~ "You need to cancel it first."
|
||||
#~ msgstr ""
|
||||
#~ "No se puede eliminar una línea de una orden de pago cuyo estado es '%s'. "
|
||||
#~ "Primero debes cancelarla."
|
||||
|
||||
#~ msgid "Followers (Channels)"
|
||||
#~ msgstr "Seguidores (Canales)"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "For partner '%s', the account of the account move line to pay (%s) is "
|
||||
#~ "different from the account of of the transit move line (%s)."
|
||||
#~ msgstr ""
|
||||
#~ "Para la empresa '%s', la cuenta del apunte a pagar (%s) es diferente de "
|
||||
#~ "la cuenta del apunte de tránsito (%s)."
|
||||
|
||||
#~ msgid "Move line '%s' of partner '%s' has already been reconciled"
|
||||
#~ msgstr "El apunte '%s' de la empresa '%s' ya ha sido conciliado"
|
||||
|
||||
#~ msgid "On payment order %s, the Payment Execution Date is in the past (%s)."
|
||||
#~ msgstr "En la orden %s, la fecha de ejecución es anterior a la actual (%s)."
|
||||
|
||||
#~ msgid "The amount for Partner '%s' is negative or null (%.2f) !"
|
||||
#~ msgstr "El importe para el empresa '%s' es negativo o nulo (%.2f) !"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "The payment mode '%s' has the option 'Disallow Debit Before Maturity "
|
||||
#~ "Date'. The payment line %s has a maturity date %s which is after the "
|
||||
#~ "computed payment date %s."
|
||||
#~ msgstr ""
|
||||
#~ "El modo de pago '%s' tiene la opción 'No permitir adeudo antes de la "
|
||||
#~ "fecha de vencimiento'. La línea de pago %s tiene una fecha de vencimiento "
|
||||
#~ "%s que es después de la fecha de pago calculada %s."
|
||||
|
||||
#~ msgid ""
|
||||
#~ "The payment type (%s) is not the same as the payment type of the payment "
|
||||
#~ "mode (%s)"
|
||||
#~ msgstr ""
|
||||
#~ "El tipo de pago (%s) no es el mismo que el tipo de pago del modo de pago "
|
||||
#~ "(%s)"
|
||||
|
||||
#~ msgid "Done"
|
||||
#~ msgstr "Realizado"
|
||||
|
||||
#~ msgid "Done Date"
|
||||
#~ msgstr "Fecha de realización"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Journal to write payment entries when confirming payment/debit orders of "
|
||||
#~ "this mode"
|
||||
#~ msgstr ""
|
||||
#~ "Diario al que escribir los asientos contables cuando se confirme la orden "
|
||||
#~ "de cobro/pago de este modo"
|
||||
|
||||
#~ msgid "Number of Bank Lines"
|
||||
#~ msgstr "Número de líneas bancarias"
|
||||
|
||||
#~ msgid "Offsetting Account"
|
||||
#~ msgstr "Cuenta de compensación"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "On the payment mode '%s', you must select a value for the 'Transfer "
|
||||
#~ "Account'."
|
||||
#~ msgstr ""
|
||||
#~ "En el modo de pago '%s', debe seleccionar un valor para la 'Cuenta de "
|
||||
#~ "transferencia'."
|
||||
|
||||
#~ msgid ""
|
||||
#~ "On the payment mode '%s', you must select a value for the 'Transfer "
|
||||
#~ "Journal'."
|
||||
#~ msgstr ""
|
||||
#~ "En el modo de pago '%s', debe seleccionar un valor para el 'Diario de "
|
||||
#~ "transferencia'."
|
||||
|
||||
#~ msgid ""
|
||||
#~ "On the payment mode '%s', you must select an option for the 'Offsetting "
|
||||
#~ "Account' parameter"
|
||||
#~ msgstr ""
|
||||
#~ "En el modo de pago '%s', debe seleccionar una opción para el parámetro "
|
||||
#~ "'Cuenta de compensación'"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Pay off lines in 'file uploaded' payment orders with a move on this "
|
||||
#~ "account. You can only select accounts that are marked for reconciliation"
|
||||
#~ msgstr ""
|
||||
#~ "Las líneas de pago de la orden se conciliarán en la 'subida de archivo' "
|
||||
#~ "con un apunte a esta cuenta. Sólo puede seleccionar las cuentas que están "
|
||||
#~ "marcadas para conciliación"
|
||||
|
||||
#~ msgid "Transaction Lines"
|
||||
#~ msgstr "Líneas de transacción"
|
||||
|
||||
#~ msgid "Transfer Account"
|
||||
#~ msgstr "Cuenta de transferencia"
|
||||
|
||||
#~ msgid "Transfer Journal"
|
||||
#~ msgstr "Diario de transferencia"
|
||||
|
||||
#~ msgid "Transfer Journal Entries"
|
||||
#~ msgstr "Asientos de transferencia"
|
||||
|
||||
#~ msgid "Due date"
|
||||
#~ msgstr "Fecha de vencimiento"
|
||||
|
||||
#~ msgid "ISO"
|
||||
#~ msgstr "ISO"
|
||||
|
||||
#~ msgid "Invoice"
|
||||
#~ msgstr "Factura"
|
||||
|
||||
#~ msgid "No Journal Entry on invoice %s"
|
||||
#~ msgstr "No se ha encontrado asiento en la factura %s"
|
||||
|
||||
#~ msgid "Payment Order / Payment"
|
||||
#~ msgstr "Orden de Pago / Pago"
|
||||
|
||||
#~ msgid "Account Entry"
|
||||
#~ msgstr "Asiento contable"
|
||||
|
||||
#~ msgid "report.account_payment_order.print_account_payment_order_main"
|
||||
#~ msgstr "report.account_payment_order.print_account_payment_order_main"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright 2019 ACSONE SA/NV
|
||||
# Copyright 2022 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2023 Noviat
|
||||
# Copyright 2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
@@ -67,3 +68,16 @@ class AccountPayment(models.Model):
|
||||
self.env.context, default_payment_reference=self.payment_reference
|
||||
),
|
||||
}
|
||||
|
||||
def _prepare_move_line_default_vals(self, write_off_line_vals=None):
|
||||
"""Overwrite date_maturity of the move_lines that are generated when related
|
||||
to a payment order.
|
||||
"""
|
||||
vals_list = super()._prepare_move_line_default_vals(
|
||||
write_off_line_vals=write_off_line_vals
|
||||
)
|
||||
if not self.payment_order_id:
|
||||
return vals_list
|
||||
for vals in vals_list:
|
||||
vals["date_maturity"] = self.payment_line_ids[0].date
|
||||
return vals_list
|
||||
|
||||
@@ -186,13 +186,14 @@ class AccountPaymentLine(models.Model):
|
||||
payment lines.
|
||||
"""
|
||||
journal = self.order_id.journal_id
|
||||
payment_mode = self.order_id.payment_mode_id
|
||||
vals = {
|
||||
"payment_type": self.order_id.payment_type,
|
||||
"partner_id": self.partner_id.id,
|
||||
"destination_account_id": self.move_line_id.account_id.id,
|
||||
"company_id": self.order_id.company_id.id,
|
||||
"amount": sum(self.mapped("amount_currency")),
|
||||
"date": self[:1].date,
|
||||
"date": fields.Date.today(),
|
||||
"currency_id": self.currency_id.id,
|
||||
"ref": self.order_id.name,
|
||||
# Put the name as the wildcard for forcing a unique name. If not, Odoo gets
|
||||
@@ -207,11 +208,7 @@ class AccountPaymentLine(models.Model):
|
||||
# Determine payment method line according payment method and journal
|
||||
line = self.env["account.payment.method.line"].search(
|
||||
[
|
||||
(
|
||||
"payment_method_id",
|
||||
"=",
|
||||
self.order_id.payment_mode_id.payment_method_id.id,
|
||||
),
|
||||
("payment_method_id", "=", payment_mode.payment_method_id.id),
|
||||
("journal_id", "=", journal.id),
|
||||
],
|
||||
limit=1,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# Copyright 2017 Camptocamp SA
|
||||
# Copyright 2017 Creu Blanca
|
||||
# Copyright 2019-2022 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from datetime import date, timedelta
|
||||
|
||||
from freezegun import freeze_time
|
||||
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tests import tagged
|
||||
from odoo.tests.common import Form
|
||||
@@ -153,3 +155,25 @@ class TestPaymentOrderInbound(TestPaymentOrderInboundBase):
|
||||
with self.assertRaises(ValidationError):
|
||||
payment_line_2 = self._line_creation(inbound_order)
|
||||
inbound_order.payment_line_ids |= payment_line_2
|
||||
|
||||
@freeze_time("2024-04-01")
|
||||
def test_creation_transfer_move_date(self):
|
||||
self.inbound_order.date_prefered = "fixed"
|
||||
self.inbound_order.date_scheduled = "2024-06-01"
|
||||
self.inbound_order.draft2open()
|
||||
payment_move = self.inbound_order.payment_ids.move_id
|
||||
self.assertEqual(payment_move.date, date(2024, 4, 1)) # now
|
||||
self.assertEqual(
|
||||
payment_move.line_ids.mapped("date_maturity"),
|
||||
[date(2024, 6, 1), date(2024, 6, 1)],
|
||||
)
|
||||
self.assertEqual(self.inbound_order.payment_count, 1)
|
||||
self.inbound_order.open2generated()
|
||||
self.inbound_order.generated2uploaded()
|
||||
self.assertEqual(self.inbound_order.state, "uploaded")
|
||||
payment_move = self.inbound_order.payment_ids.move_id
|
||||
self.assertEqual(payment_move.date, date(2024, 4, 1)) # now
|
||||
self.assertEqual(
|
||||
payment_move.line_ids.mapped("date_maturity"),
|
||||
[date(2024, 6, 1), date(2024, 6, 1)],
|
||||
)
|
||||
|
||||
@@ -373,8 +373,7 @@ class TestPaymentOrderOutbound(TestPaymentOrderOutboundBase):
|
||||
outbound_order.draft2open()
|
||||
self.assertEqual(outbound_order.payment_count, 2)
|
||||
self.assertEqual(
|
||||
outbound_order.payment_line_ids[0].date,
|
||||
outbound_order.payment_line_ids[0].payment_ids.date,
|
||||
outbound_order.payment_line_ids[0].payment_ids.date, fields.Date.today()
|
||||
)
|
||||
self.assertEqual(outbound_order.payment_line_ids[1].date, date.today())
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user