mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG]account_banking_mandate: Migration to 15.0
[UPD] Update account_banking_mandate.pot [UPD] README.rst
This commit is contained in:
@@ -14,13 +14,13 @@ Account Banking Mandate
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/bank-payment/tree/14.0/account_banking_mandate
|
||||
:target: https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate
|
||||
:alt: OCA/bank-payment
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_banking_mandate
|
||||
:target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_banking_mandate
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/173/14.0
|
||||
:target: https://runbot.odoo-community.org/runbot/173/15.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -58,7 +58,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/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 <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
@@ -84,6 +84,7 @@ Contributors
|
||||
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||
* Marçal Isern <marsal.isern@qubiq.es>
|
||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||
* Manuel Regidor <manuel.regidor@sygel.es>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -98,6 +99,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/bank-payment <https://github.com/OCA/bank-payment/tree/14.0/account_banking_mandate>`_ project on GitHub.
|
||||
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
"name": "Account Banking Mandate",
|
||||
"summary": "Banking mandates",
|
||||
"version": "14.0.1.2.0",
|
||||
"version": "15.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Compassion CH, "
|
||||
"Tecnativa, "
|
||||
|
||||
@@ -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"
|
||||
@@ -98,7 +98,6 @@ msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model_terms:ir.ui.view,arch_db:account_banking_mandate.view_mandate_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_banking_mandate.view_mandate_tree
|
||||
msgid "Banking Mandate"
|
||||
msgstr ""
|
||||
|
||||
@@ -199,13 +198,6 @@ msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_banking_mandate__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_move_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_payment_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_payment_method__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_bank_payment_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_res_partner__display_name
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_res_partner_bank__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
@@ -233,11 +225,6 @@ msgstr ""
|
||||
msgid "Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_banking_mandate__message_channel_ids
|
||||
msgid "Followers (Channels)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_banking_mandate__message_partner_ids
|
||||
msgid "Followers (Partners)"
|
||||
@@ -264,15 +251,13 @@ msgstr ""
|
||||
msgid "Group By"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_banking_mandate__has_message
|
||||
msgid "Has Message"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_banking_mandate__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_move_line__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_payment_line__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_payment_method__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_bank_payment_line__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_res_partner__id
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_res_partner_bank__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
@@ -315,13 +300,6 @@ msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_banking_mandate____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_move_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_payment_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_account_payment_method____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_bank_payment_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_res_partner____last_update
|
||||
#: model:ir.model.fields,field_description:account_banking_mandate.field_res_partner_bank____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
@@ -567,16 +545,17 @@ msgstr ""
|
||||
#: code:addons/account_banking_mandate/models/account_payment_line.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The payment line number %s a different company than that of the linked "
|
||||
"mandate %s)."
|
||||
"The payment line number {line_number} a different company than that of the "
|
||||
"linked mandate {mandate})."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
#: code:addons/account_banking_mandate/models/account_payment_line.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The payment line number %s has the bank account '%s' which is not attached "
|
||||
"to the mandate '%s' (this mandate is attached to the bank account '%s')."
|
||||
"The payment line number {line_number} has the bank account "
|
||||
"'{line_bank_account}' which is not attached to the mandate '{mandate_ref}' "
|
||||
"(this mandate is attached to the bank account '{mandate_bank_account}')."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_mandate
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# Copyright 2021 Opener B.V. - Stefan Rijnhart <stefan@opener.amsterdam>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
import logging
|
||||
|
||||
from odoo.tools.sql import column_exists
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
logger = logging.getLogger(
|
||||
"odoo.addons.account_banking_mandate.migrations.14.0.1.0.0"
|
||||
)
|
||||
if not column_exists(cr, "account_move_line", "mandate_id"):
|
||||
logger.warning(
|
||||
"Column account_move_line.mandate_id not found when "
|
||||
"populating account_move.mandate_id"
|
||||
)
|
||||
return
|
||||
logger.info(
|
||||
"Populating account_move.mandate_id from obsolete "
|
||||
"account_move_line.mandate_id"
|
||||
)
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE account_move am
|
||||
SET mandate_id = aml.mandate_id
|
||||
FROM account_move_line aml
|
||||
WHERE aml.mandate_id IS NOT NULL
|
||||
AND am.mandate_id IS NULL
|
||||
AND am.id=aml.move_id
|
||||
"""
|
||||
)
|
||||
@@ -60,9 +60,7 @@ class AccountBankingMandate(models.Model):
|
||||
required=True,
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
unique_mandate_reference = fields.Char(
|
||||
string="Unique Mandate Reference", tracking=10, copy=False
|
||||
)
|
||||
unique_mandate_reference = fields.Char(tracking=10, copy=False)
|
||||
signature_date = fields.Date(
|
||||
string="Date of Signature of the Mandate",
|
||||
tracking=50,
|
||||
|
||||
@@ -30,15 +30,16 @@ class AccountPaymentLine(models.Model):
|
||||
):
|
||||
raise ValidationError(
|
||||
_(
|
||||
"The payment line number %s has the bank account "
|
||||
"'%s' which is not attached to the mandate '%s' (this "
|
||||
"mandate is attached to the bank account '%s')."
|
||||
)
|
||||
% (
|
||||
pline.name,
|
||||
pline.partner_bank_id.acc_number,
|
||||
pline.mandate_id.unique_mandate_reference,
|
||||
pline.mandate_id.partner_bank_id.acc_number,
|
||||
"The payment line number {line_number} has "
|
||||
"the bank account '{line_bank_account}' which "
|
||||
"is not attached to the mandate '{mandate_ref}' "
|
||||
"(this mandate is attached to the bank account "
|
||||
"'{mandate_bank_account}')."
|
||||
).format(
|
||||
line_number=pline.name,
|
||||
line_bank_account=pline.partner_bank_id.acc_number,
|
||||
mandate_ref=pline.mandate_id.unique_mandate_reference,
|
||||
mandate_bank_account=pline.mandate_id.partner_bank_id.acc_number,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -51,10 +52,11 @@ class AccountPaymentLine(models.Model):
|
||||
):
|
||||
raise ValidationError(
|
||||
_(
|
||||
"The payment line number %s a different company than "
|
||||
"that of the linked mandate %s)."
|
||||
"The payment line number {line_number} a different "
|
||||
"company than that of the linked mandate {mandate})."
|
||||
).format(
|
||||
line_number=pline.name, mandate=pline.mandate_id.display_name
|
||||
)
|
||||
% (pline.name, pline.mandate_id.display_name)
|
||||
)
|
||||
|
||||
def draft2open_payment_line_check(self):
|
||||
|
||||
@@ -8,7 +8,6 @@ class AccountPaymentMethod(models.Model):
|
||||
_inherit = "account.payment.method"
|
||||
|
||||
mandate_required = fields.Boolean(
|
||||
string="Mandate Required",
|
||||
help="Activate this option if this payment method requires your "
|
||||
"customer to sign a direct debit mandate with your company.",
|
||||
)
|
||||
|
||||
@@ -31,11 +31,6 @@ class ResPartner(models.Model):
|
||||
def _compute_valid_mandate_id(self):
|
||||
# Dict for reducing the duplicated searches on parent/child partners
|
||||
company_id = self.env.company.id
|
||||
if company_id:
|
||||
company = self.env["res.company"].browse(company_id)
|
||||
else:
|
||||
company = self.env.company
|
||||
|
||||
mandates_dic = {}
|
||||
for partner in self:
|
||||
commercial_partner_id = partner.commercial_partner_id.id
|
||||
@@ -44,7 +39,9 @@ class ResPartner(models.Model):
|
||||
else:
|
||||
mandates = partner.commercial_partner_id.bank_ids.mapped(
|
||||
"mandate_ids"
|
||||
).filtered(lambda x: x.state == "valid" and x.company_id == company)
|
||||
).filtered(
|
||||
lambda x: x.state == "valid" and x.company_id.id == company_id
|
||||
)
|
||||
first_valid_mandate_id = mandates[:1].id
|
||||
partner.valid_mandate_id = first_valid_mandate_id
|
||||
mandates_dic[commercial_partner_id] = first_valid_mandate_id
|
||||
|
||||
@@ -7,3 +7,4 @@
|
||||
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||
* Marçal Isern <marsal.isern@qubiq.es>
|
||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||
* Manuel Regidor <manuel.regidor@sygel.es>
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-payment/tree/14.0/account_banking_mandate"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_banking_mandate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/173/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_banking_mandate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/173/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds a generic model for banking mandates.
|
||||
These mandates can be specialized to fit any banking mandates (such as sepa or lsv).</p>
|
||||
<p>A banking mandate is attached to a bank account and represents an
|
||||
@@ -404,7 +404,7 @@ account.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-payment/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -429,6 +429,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<li>Carlos Dauden <<a class="reference external" href="mailto:carlos.dauden@tecnativa.com">carlos.dauden@tecnativa.com</a>></li>
|
||||
<li>Marçal Isern <<a class="reference external" href="mailto:marsal.isern@qubiq.es">marsal.isern@qubiq.es</a>></li>
|
||||
<li>Andrea Stirpe <<a class="reference external" href="mailto:a.stirpe@onestein.nl">a.stirpe@onestein.nl</a>></li>
|
||||
<li>Manuel Regidor <<a class="reference external" href="mailto:manuel.regidor@sygel.es">manuel.regidor@sygel.es</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -438,7 +439,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/14.0/account_banking_mandate">OCA/bank-payment</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate">OCA/bank-payment</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Copyright 2017 Creu Blanca
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from odoo import fields
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
from odoo.addons.account.models.account_payment_method import AccountPaymentMethod
|
||||
|
||||
|
||||
class TestInvoiceMandate(TransactionCase):
|
||||
def test_post_invoice_01(self):
|
||||
@@ -76,6 +80,7 @@ class TestInvoiceMandate(TransactionCase):
|
||||
"date": fields.Date.today(),
|
||||
"reason": "no reason",
|
||||
"refund_method": "refund",
|
||||
"journal_id": self.invoice.journal_id.id,
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -117,6 +122,16 @@ class TestInvoiceMandate(TransactionCase):
|
||||
self.assertEqual(invoice.mandate_id, mandate_2)
|
||||
|
||||
def test_onchange_payment_mode(self):
|
||||
|
||||
Method_get_payment_method_information = (
|
||||
AccountPaymentMethod._get_payment_method_information
|
||||
)
|
||||
|
||||
def _get_payment_method_information(self):
|
||||
res = Method_get_payment_method_information(self)
|
||||
res["test"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
|
||||
return res
|
||||
|
||||
invoice = self.env["account.move"].new(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
@@ -126,14 +141,19 @@ class TestInvoiceMandate(TransactionCase):
|
||||
)
|
||||
invoice._onchange_partner_id()
|
||||
|
||||
pay_method_test = self.env["account.payment.method"].create(
|
||||
{
|
||||
"name": "Test",
|
||||
"code": "test",
|
||||
"payment_type": "inbound",
|
||||
"mandate_required": False,
|
||||
}
|
||||
)
|
||||
with patch.object(
|
||||
AccountPaymentMethod,
|
||||
"_get_payment_method_information",
|
||||
_get_payment_method_information,
|
||||
):
|
||||
pay_method_test = self.env["account.payment.method"].create(
|
||||
{
|
||||
"name": "Test",
|
||||
"code": "test",
|
||||
"payment_type": "inbound",
|
||||
"mandate_required": False,
|
||||
}
|
||||
)
|
||||
mode_inbound_acme_2 = self.env["account.payment.mode"].create(
|
||||
{
|
||||
"name": "Inbound Credit ACME Bank 2",
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
<field name="name">view.mandate.tree</field>
|
||||
<field name="model">account.banking.mandate</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Banking Mandate">
|
||||
<tree>
|
||||
<field name="id" invisible="1" />
|
||||
<field name="unique_mandate_reference" string="Reference" />
|
||||
<field
|
||||
|
||||
Reference in New Issue
Block a user