mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MRG] Sync with 7.0 branch
This commit is contained in:
@@ -1211,8 +1211,6 @@ class banking_import_transaction(orm.Model):
|
||||
'match_type',
|
||||
'move_line_id',
|
||||
'invoice_id',
|
||||
'manual_invoice_id',
|
||||
'manual_move_line_id',
|
||||
]] +
|
||||
[(x, [(6, 0, [])]) for x in [
|
||||
'move_line_ids',
|
||||
@@ -1299,9 +1297,9 @@ class banking_import_transaction(orm.Model):
|
||||
'exchange_rate': fields.float('exchange_rate'),
|
||||
'transferred_amount': fields.float('transferred_amount'),
|
||||
'message': fields.char('message', size=1024),
|
||||
'remote_owner': fields.char('remote_owner', size=24),
|
||||
'remote_owner_address': fields.char('remote_owner_address', size=24),
|
||||
'remote_owner_city': fields.char('remote_owner_city', size=24),
|
||||
'remote_owner': fields.char('remote_owner', size=128),
|
||||
'remote_owner_address': fields.char('remote_owner_address', size=256),
|
||||
'remote_owner_city': fields.char('remote_owner_city', size=128),
|
||||
'remote_owner_postalcode': fields.char('remote_owner_postalcode', size=24),
|
||||
'remote_owner_country_code': fields.char('remote_owner_country_code', size=24),
|
||||
'remote_owner_custno': fields.char('remote_owner_custno', size=24),
|
||||
|
||||
33
account_banking/migrations/7.0.0.1/pre-migration.py
Normal file
33
account_banking/migrations/7.0.0.1/pre-migration.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2013 Therp BV (<http://therp.nl>).
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
# workflow state moved to another, new module
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE ir_model_data
|
||||
SET module = 'account_banking_payment'
|
||||
WHERE name = 'trans_done_sent'
|
||||
AND module = 'account_direct_debit'
|
||||
""")
|
||||
@@ -314,6 +314,10 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
'ref': fields.related(
|
||||
'statement_line_id', 'ref', type='char', size=32,
|
||||
string="Reference", readonly=True),
|
||||
'message': fields.related(
|
||||
'statement_line_id', 'import_transaction_id', 'message',
|
||||
type='char', size=1024,
|
||||
string="Message", readonly=True),
|
||||
'partner_id': fields.related(
|
||||
'statement_line_id', 'partner_id',
|
||||
type='many2one', relation='res.partner',
|
||||
@@ -363,13 +367,6 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
('payment_order_manual', 'Payment order (manual)'),
|
||||
],
|
||||
string='Match type', readonly=True),
|
||||
'manual_invoice_id': fields.many2one(
|
||||
'account.invoice', 'Match this invoice',
|
||||
domain=[('reconciled', '=', False)]),
|
||||
'manual_move_line_id': fields.many2one(
|
||||
'account.move.line', 'Or match this entry',
|
||||
domain=[('account_id.reconcile', '=', True),
|
||||
('reconcile_id', '=', False)]),
|
||||
'manual_invoice_ids': fields.many2many(
|
||||
'account.invoice',
|
||||
'banking_transaction_wizard_account_invoice_rel',
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
<separator string="Transaction data" colspan="4"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="amount"/>
|
||||
<field name="ref"/>
|
||||
<field name="message" colspan="4"/>
|
||||
</group>
|
||||
|
||||
<!-- (semi-) automatic matching and selection -->
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
from openerp.osv import orm, fields
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.account_banking.wizard import banktools
|
||||
import ast
|
||||
|
||||
class link_partner(orm.TransientModel):
|
||||
_name = 'banking.link_partner'
|
||||
@@ -37,6 +38,16 @@ class link_partner(orm.TransientModel):
|
||||
'statement_line_id': fields.many2one(
|
||||
'account.bank.statement.line',
|
||||
'Statement line', required=True),
|
||||
'amount': fields.related(
|
||||
'statement_line_id', 'amount', type='float',
|
||||
string="Amount", readonly=True),
|
||||
'ref': fields.related(
|
||||
'statement_line_id', 'ref', type='char', size=32,
|
||||
string="Reference", readonly=True),
|
||||
'message': fields.related(
|
||||
'statement_line_id', 'import_transaction_id', 'message',
|
||||
type='char', size=1024,
|
||||
string="Message", readonly=True),
|
||||
'remote_account': fields.char(
|
||||
'Account number', size=24, readonly=True),
|
||||
# Partner values
|
||||
@@ -50,6 +61,11 @@ class link_partner(orm.TransientModel):
|
||||
'phone': fields.char('Phone', size=64),
|
||||
'fax': fields.char('Fax', size=64),
|
||||
'mobile': fields.char('Mobile', size=64),
|
||||
'is_company': fields.boolean('Is a Company'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'is_company': True,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
@@ -79,9 +95,19 @@ class link_partner(orm.TransientModel):
|
||||
if 'customer' not in vals and statement_line.amount > 0:
|
||||
vals['customer'] = True
|
||||
|
||||
if not vals.get('street'):
|
||||
vals['street'] = transaction.remote_owner_address
|
||||
if not vals.get('street'):
|
||||
address_list = []
|
||||
try:
|
||||
address_list = ast.literal_eval(
|
||||
transaction.remote_owner_address or [])
|
||||
except ValueError:
|
||||
pass
|
||||
if address_list and not vals.get('street'):
|
||||
vals['street'] = address_list.pop(0)
|
||||
if address_list and not vals.get('street2'):
|
||||
vals['street2'] = address_list.pop(0)
|
||||
if transaction.remote_owner_postalcode and not vals.get('zip'):
|
||||
vals['zip'] = transaction.remote_owner_postalcode
|
||||
if transaction.remote_owner_city and not vals.get('city'):
|
||||
vals['city'] = transaction.remote_owner_city
|
||||
if not vals.get('country_id'):
|
||||
vals['country_id'] = banktools.get_country_id(
|
||||
@@ -101,10 +127,12 @@ class link_partner(orm.TransientModel):
|
||||
:param wizard: read record of wizard (with load='_classic_write')
|
||||
:param values: the dictionary of partner values that will be updated
|
||||
"""
|
||||
for field in ['name',
|
||||
for field in ['is_company',
|
||||
'name',
|
||||
'street',
|
||||
'street2',
|
||||
'zip',
|
||||
'city',
|
||||
'country_id',
|
||||
'state_id',
|
||||
'phone',
|
||||
@@ -126,10 +154,7 @@ class link_partner(orm.TransientModel):
|
||||
else:
|
||||
wiz_read = self.read(
|
||||
cr, uid, ids[0], context=context, load='_classic_write')
|
||||
partner_fields = self.pool.get(
|
||||
'res.partner')._columns.keys()
|
||||
partner_vals = {
|
||||
'is_company': True,
|
||||
'type': 'default',
|
||||
}
|
||||
self.update_partner_values(
|
||||
|
||||
@@ -7,15 +7,24 @@
|
||||
<field name="model">banking.link_partner</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Link partner">
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="4" col="6" string="Transaction data">
|
||||
<field name="ref" />
|
||||
<field name="amount" />
|
||||
<field name="remote_account" />
|
||||
<field name="message" colspan="6"/>
|
||||
</group>
|
||||
<group colspan="4" col="4" string="Create or link partner">
|
||||
<field name="name"
|
||||
attrs="{'readonly': [('partner_id', '!=', False)]}" />
|
||||
<field name="partner_id"/>
|
||||
<field name="remote_account" />
|
||||
</group>
|
||||
<group colspan="2">
|
||||
<field name="is_company" />
|
||||
</group>
|
||||
<group colspan="4"
|
||||
string="Address"
|
||||
attrs="{'invisible': [('partner_id', '!=', False)]}">
|
||||
attrs="{'invisible': [('partner_id', '!=', False)]}"
|
||||
col="4">
|
||||
<group colspan="2" col="2">
|
||||
<field name="street"/>
|
||||
<field name="street2"/>
|
||||
|
||||
38
account_direct_debit/migrations/7.0.2/post-migration.py
Normal file
38
account_direct_debit/migrations/7.0.2/post-migration.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2013 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# All other contributions are (C) by their respective contributors
|
||||
#
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE payment_line
|
||||
SET transit_move_line_id = banking_addons_61_debit_move_line_id
|
||||
""")
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE "payment_line"
|
||||
DROP COLUMN "banking_addons_61_debit_move_line_id"
|
||||
"""
|
||||
)
|
||||
@@ -22,6 +22,9 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger()
|
||||
|
||||
def rename_columns(cr, column_spec):
|
||||
"""
|
||||
Rename table columns. Taken from OpenUpgrade.
|
||||
@@ -41,17 +44,8 @@ def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
# workflow state moved to another module
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE ir_model_data
|
||||
SET module = 'account_banking_payment'
|
||||
WHERE name = 'trans_done_sent'
|
||||
AND module = 'account_direct_debit'
|
||||
""")
|
||||
|
||||
# rename field debit_move_line_id
|
||||
rename_columns(cr, {
|
||||
'payment_line': [
|
||||
('debit_move_line_id', 'transit_move_line_id'),
|
||||
('debit_move_line_id', 'banking_addons_61_debit_move_line_id'),
|
||||
]})
|
||||
|
||||
Reference in New Issue
Block a user