mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[REF] account_banking_mandate: Adapt module to native payment refactoring
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Copyright 2014 Compassion CH - Cyril Sester <csester@compassion.ch>
|
||||
# Copyright 2014 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2015-2020 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2017 Tecnativa - Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||
# Copyright 2017 Tecnativa - Carlos Dauden
|
||||
# Copyright 2014-2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
@@ -23,7 +23,6 @@
|
||||
"views/account_payment_line.xml",
|
||||
"views/res_partner_bank_view.xml",
|
||||
"views/res_partner.xml",
|
||||
"views/bank_payment_line_view.xml",
|
||||
"data/mandate_reference_sequence.xml",
|
||||
"security/mandate_security.xml",
|
||||
"security/ir.model.access.csv",
|
||||
|
||||
@@ -4,5 +4,4 @@ from . import account_move
|
||||
from . import res_partner_bank
|
||||
from . import res_partner
|
||||
from . import account_payment_line
|
||||
from . import bank_payment_line
|
||||
from . import account_move_line
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# Copyright 2014 Compassion CH - Cyril Sester <csester@compassion.ch>
|
||||
# Copyright 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2015-16 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class BankPaymentLine(models.Model):
|
||||
_inherit = "bank.payment.line"
|
||||
|
||||
mandate_id = fields.Many2one(
|
||||
comodel_name="account.banking.mandate",
|
||||
string="Direct Debit Mandate",
|
||||
related="payment_line_ids.mandate_id",
|
||||
check_company=True,
|
||||
)
|
||||
|
||||
@api.model
|
||||
def same_fields_payment_line_and_bank_payment_line(self):
|
||||
res = super().same_fields_payment_line_and_bank_payment_line()
|
||||
res.append("mandate_id")
|
||||
return res
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright 2017 Creu Blanca
|
||||
# Copyright 2017-2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields
|
||||
@@ -9,27 +10,16 @@ from odoo.tests.common import TransactionCase
|
||||
class TestInvoiceMandate(TransactionCase):
|
||||
def test_post_invoice_01(self):
|
||||
self.invoice._onchange_partner_id()
|
||||
|
||||
prev_orders = self.env["account.payment.order"].search([])
|
||||
self.assertEqual(self.invoice.mandate_id, self.mandate)
|
||||
|
||||
self.invoice.action_post()
|
||||
|
||||
payable_move_lines = self.invoice.line_ids.filtered(
|
||||
lambda s: s.account_id == self.invoice_account
|
||||
)
|
||||
if payable_move_lines:
|
||||
self.assertEqual(payable_move_lines[0].move_id.mandate_id, self.mandate)
|
||||
|
||||
self.env["account.invoice.payment.line.multi"].with_context(
|
||||
active_model="account.move", active_ids=self.invoice.ids
|
||||
).create({}).run()
|
||||
|
||||
payment_order = self.env["account.payment.order"].search([])
|
||||
payment_order = self.env["account.payment.order"].search([]) - prev_orders
|
||||
self.assertEqual(len(payment_order.ids), 1)
|
||||
payment_order.payment_mode_id_change()
|
||||
payment_order.draft2open()
|
||||
payment_order.open2generated()
|
||||
payment_order.generated2uploaded()
|
||||
self.assertEqual(self.mandate.payment_line_ids_count, 1)
|
||||
|
||||
def test_post_invoice_02(self):
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
© 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="bank_payment_line_form" model="ir.ui.view">
|
||||
<field name="name">banking.mandate.bank.payment.line.form</field>
|
||||
<field name="model">bank.payment.line</field>
|
||||
<field name="inherit_id" ref="account_payment_order.bank_payment_line_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_bank_id" position="after">
|
||||
<field
|
||||
name="mandate_id"
|
||||
invisible="context.get('default_payment_type')!='inbound'"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<record id="bank_payment_line_tree" model="ir.ui.view">
|
||||
<field name="name">banking.mandate.bank.payment.line.tree</field>
|
||||
<field name="model">bank.payment.line</field>
|
||||
<field name="inherit_id" ref="account_payment_order.bank_payment_line_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_bank_id" position="after">
|
||||
<field
|
||||
name="mandate_id"
|
||||
string="Mandate"
|
||||
invisible="context.get('default_payment_type')!='inbound'"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user