mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG] account_banking_mandate: Finish migration to v12
* Adapted test * Removed unneeded constraint * Fixed view for accessibility
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
# 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, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class BankPaymentLine(models.Model):
|
||||
@@ -20,13 +19,3 @@ class BankPaymentLine(models.Model):
|
||||
same_fields_payment_line_and_bank_payment_line()
|
||||
res.append('mandate_id')
|
||||
return res
|
||||
|
||||
@api.constrains('mandate_id', 'company_id')
|
||||
def _check_company_constrains(self):
|
||||
for line in self:
|
||||
if line.mandate_id.company_id and line.mandate_id.company_id != \
|
||||
line.company_id:
|
||||
raise ValidationError(_(
|
||||
"The bank payment line %s has a different company than "
|
||||
"that of the linked mandate %s).") %
|
||||
(line.name, line.mandate_id.display_name))
|
||||
|
||||
@@ -107,6 +107,7 @@ class TestMandate(TransactionCase):
|
||||
bank_account_2 = self.env['res.partner.bank'].create({
|
||||
'acc_number': '1234',
|
||||
'company_id': self.company_2.id,
|
||||
'partner_id': self.company_2.partner_id.id,
|
||||
})
|
||||
with self.assertRaises(ValidationError):
|
||||
mandate.partner_bank_id = bank_account_2
|
||||
@@ -119,6 +120,7 @@ class TestMandate(TransactionCase):
|
||||
bank_account = self.env['res.partner.bank'].create({
|
||||
'acc_number': '1234',
|
||||
'company_id': self.company_2.id,
|
||||
'partner_id': self.company_2.partner_id.id,
|
||||
})
|
||||
with self.assertRaises(ValidationError):
|
||||
bank_account.mandate_ids += mandate
|
||||
|
||||
@@ -68,11 +68,20 @@
|
||||
<field name="unique_mandate_reference" string="Reference"/>
|
||||
<field name="signature_date" string="Signature Date"/>
|
||||
<field name="last_debit_date"/>
|
||||
<button name="validate" type="object" icon="fa-check"
|
||||
<button name="validate"
|
||||
type="object"
|
||||
icon="fa-check"
|
||||
string="Validate"
|
||||
attrs="{'invisible': ['|', ('id', '=', False), ('state', '!=', 'draft')]}"/>
|
||||
<button name="cancel" type="object" icon="fa-times"
|
||||
<button name="cancel"
|
||||
type="object"
|
||||
icon="fa-times"
|
||||
string="Cancel"
|
||||
attrs="{'invisible': ['|', ('id', '=', False), ('state', '=', 'cancel')]}"/>
|
||||
<button name="back2draft" type="object" icon="fa-undo"
|
||||
<button name="back2draft"
|
||||
type="object"
|
||||
icon="fa-undo"
|
||||
string="Draft"
|
||||
groups="account.group_account_manager"
|
||||
attrs="{'invisible': ['|', ('id', '=', False), ('state', '!=', 'cancel')]}"/>
|
||||
<field name="state"/>
|
||||
|
||||
Reference in New Issue
Block a user