mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_banking_mandate: Put binary field as attachment
For not wasting space in DB. Migration scripts included (requires openupgradelib).
This commit is contained in:
committed by
Reyes4711
parent
98f6d8cd92
commit
42aea59a85
@@ -7,7 +7,7 @@
|
||||
{
|
||||
'name': 'Account Banking Mandate',
|
||||
'summary': 'Banking mandates',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '12.0.2.0.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': "Compassion CH, "
|
||||
"Tecnativa, "
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
from openupgradelib import openupgrade_90
|
||||
|
||||
|
||||
@openupgrade.migrate(use_env=True)
|
||||
def migrate(env, version):
|
||||
column = openupgrade.get_legacy_name('scan')
|
||||
if openupgrade.column_exists(env.cr, 'account_banking_mandate', column):
|
||||
openupgrade_90.convert_binary_field_to_attachment(
|
||||
env, {'account.banking.mandate': [('scan', None)]},
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
column_renames = {
|
||||
'account_banking_mandate': [
|
||||
('scan', None),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(cr, version):
|
||||
if openupgrade.column_exists(cr, 'account_banking_mandate', 'scan'):
|
||||
openupgrade.rename_columns(cr, column_renames)
|
||||
@@ -53,7 +53,10 @@ class AccountBankingMandate(models.Model):
|
||||
)
|
||||
signature_date = fields.Date(string='Date of Signature of the Mandate',
|
||||
track_visibility='onchange')
|
||||
scan = fields.Binary(string='Scan of the Mandate')
|
||||
scan = fields.Binary(
|
||||
string='Scan of the Mandate',
|
||||
attachment=True,
|
||||
)
|
||||
last_debit_date = fields.Date(string='Date of the Last Debit',
|
||||
readonly=True)
|
||||
state = fields.Selection([
|
||||
|
||||
Reference in New Issue
Block a user