mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] Single manual reconcile is redundant when we can reconcile with
multiple invoices in the next tab
This commit is contained in:
@@ -1196,7 +1196,7 @@ class banking_import_transaction(orm.Model):
|
||||
not(transaction.move_currency_amount is False)):
|
||||
res[transaction.id] = (
|
||||
transaction.move_currency_amount -
|
||||
transaction.transferred_amount
|
||||
transaction.statement_line_id.amount
|
||||
)
|
||||
return res
|
||||
|
||||
@@ -1739,10 +1739,14 @@ class account_bank_statement_line(orm.Model):
|
||||
(statement_line_data['name'] or '') + _(' (split)'))
|
||||
statement_line_data['import_transaction_id'] = transaction_id
|
||||
statement_line_data['parent_id'] = this.id
|
||||
statement_line_id = self.create(
|
||||
cr, uid, statement_line_data, context=context)
|
||||
|
||||
child_statement_ids.append(
|
||||
self.create(cr, uid, statement_line_data,
|
||||
context=context))
|
||||
child_statement_ids.append(statement_line_id)
|
||||
transaction_pool.write(
|
||||
cr, uid, transaction_id, {
|
||||
'statement_line_id': statement_line_id,
|
||||
}, context=context)
|
||||
this.write({'amount': this.amount - amount})
|
||||
|
||||
return child_statement_ids
|
||||
|
||||
@@ -2,27 +2,17 @@
|
||||
#
|
||||
# Copyright (C) 2013 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# All other contributions are (C) by their respective contributors
|
||||
#
|
||||
# All Rights Reserved
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract EduSense BV
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
# 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 General Public License for more details.
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# 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/>.
|
||||
#
|
||||
############################################################################*/
|
||||
|
||||
@@ -96,8 +96,6 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
# The following fields get never written
|
||||
# they are just triggers for manual matching
|
||||
# which populates regular fields on the transaction
|
||||
manual_invoice_id = vals.pop('manual_invoice_id', False)
|
||||
manual_move_line_id = vals.pop('manual_move_line_id', False)
|
||||
manual_invoice_ids = vals.pop('manual_invoice_ids', [])
|
||||
manual_move_line_ids = vals.pop('manual_move_line_ids', [])
|
||||
|
||||
@@ -171,17 +169,17 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
_("No entry found for the selected invoice. " +
|
||||
"Try manual reconciliation."))
|
||||
|
||||
if manual_move_line_id or manual_invoice_id \
|
||||
or manual_move_line_ids or manual_invoice_ids:
|
||||
if manual_move_line_ids or manual_invoice_ids:
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
statement_line_obj = self.pool.get('account.bank.statement.line')
|
||||
manual_invoice_ids = (
|
||||
([manual_invoice_id] if manual_invoice_id else []) +
|
||||
# Rewrite *2many directive notation
|
||||
if manual_invoice_ids:
|
||||
manual_invoice_ids = (
|
||||
[i[1] for i in manual_invoice_ids if i[0]==4] +
|
||||
[j for i in manual_invoice_ids if i[0]==6 for j in i[2]])
|
||||
manual_move_line_ids = (
|
||||
([manual_move_line_id] if manual_move_line_id else []) +
|
||||
if manual_move_line_ids:
|
||||
manual_move_line_ids = (
|
||||
[i[1] for i in manual_move_line_ids if i[0]==4] +
|
||||
[j for i in manual_move_line_ids if i[0]==6 for j in i[2]])
|
||||
for wiz in self.browse(cr, uid, ids, context=context):
|
||||
@@ -228,7 +226,7 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
|
||||
if len(todo) > 0:
|
||||
statement_line_id = wiz.statement_line_id.split_off(
|
||||
move_line.credit or move_line.debit)[0]
|
||||
move_line.debit or -move_line.credit)[0]
|
||||
transaction_id = statement_line_obj.browse(
|
||||
cr,
|
||||
uid,
|
||||
@@ -292,7 +290,12 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
account_id = setting.default_debit_account_id and setting.default_debit_account_id.id
|
||||
statement_pool.write(cr, uid, wiz.statement_line_id.id, {'account_id':account_id})
|
||||
|
||||
wiz.write({'partner_id': False})
|
||||
# Restore partner id from the bank account or else reset
|
||||
partner_id = False
|
||||
if (wiz.statement_line_id.partner_bank_id and
|
||||
wiz.statement_line_id.partner_bank_id.partner_id):
|
||||
partner_id = wiz.statement_line_id.partner_bank_id.partner_id.id
|
||||
wiz.write({'partner_id': partner_id})
|
||||
|
||||
if wiz.statement_line_id:
|
||||
#delete splits causing an unsplit if this is a split
|
||||
@@ -391,22 +394,15 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
'match_type': fields.related(
|
||||
'import_transaction_id', 'match_type',
|
||||
type="char", size=16, 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',
|
||||
'wizard_id', 'invoice_id', string='Match following invoices',
|
||||
'wizard_id', 'invoice_id', string='Match one or more invoices',
|
||||
domain=[('reconciled', '=', False)]),
|
||||
'manual_move_line_ids': fields.many2many(
|
||||
'account.move.line',
|
||||
'banking_transaction_wizard_account_move_line_rel',
|
||||
'wizard_id', 'move_line_id', string='Or match this entries',
|
||||
'wizard_id', 'move_line_id', string='Or match one or more entries',
|
||||
domain=[('account_id.reconcile', '=', True),
|
||||
('reconcile_id', '=', False)]),
|
||||
'payment_option': fields.related('import_transaction_id','payment_option', string='Payment Difference', type='selection', required=True,
|
||||
|
||||
@@ -82,35 +82,9 @@
|
||||
name="trigger_match"
|
||||
type="object"
|
||||
string="Match again"/>
|
||||
<!-- Manual selection -->
|
||||
</page>
|
||||
<!-- Manual selection -->
|
||||
<page string="Manual match">
|
||||
<field name="manual_invoice_id"
|
||||
context="{'search_default_partner_id': partner_id}"
|
||||
/>
|
||||
<!--
|
||||
Specify alternative tree_view_ref as a
|
||||
workaround for lp:1073521 in OpenERP 6.1
|
||||
Need to also define 'view_mode' to prevent
|
||||
an instant editable tree view
|
||||
reconstruction by account.move.line's
|
||||
fields_view_get().
|
||||
Both are not needed in OpenERP 6.0 or 7.0.
|
||||
-->
|
||||
<field name="manual_move_line_id"
|
||||
context="{
|
||||
'search_default_partner_id': partner_id,
|
||||
'tree_view_ref': 'account.view_move_line_tax_tree',
|
||||
'view_mode': 'yes'
|
||||
}"
|
||||
/>
|
||||
<newline/>
|
||||
<button colspan="1"
|
||||
name="trigger_write"
|
||||
type="object"
|
||||
string="Match"/>
|
||||
</page>
|
||||
<page string="Multiple manual matches" attrs="{'invisible': ['|', ('match_type', '!=', False), ('statement_line_parent_id', '!=', False)]}">
|
||||
<field name="manual_invoice_ids" colspan="4"
|
||||
context="{'search_default_partner_id': partner_id}"
|
||||
/>
|
||||
@@ -146,7 +120,7 @@
|
||||
</notebook>
|
||||
<group colspan="2">
|
||||
<separator/>
|
||||
<button icon="gtk-ok" string="Done" special="cancel"/>
|
||||
<button icon="gtk-ok" string="Close" special="cancel"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user