Browse Source

[ADD] allow turning off automatic reconciliation during an import

pull/201/head
Holger Brunn 8 years ago
committed by George Daramouskas
parent
commit
a8384aecda
No known key found for this signature in database GPG Key ID: 5B4EF742F8CD859C
  1. 1
      account_bank_statement_import_auto_reconcile/README.rst
  2. 1
      account_bank_statement_import_auto_reconcile/__openerp__.py
  3. 10
      account_bank_statement_import_auto_reconcile/models/account_bank_statement_import.py
  4. 15
      account_bank_statement_import_auto_reconcile/views/account_bank_statement_import.xml

1
account_bank_statement_import_auto_reconcile/README.rst

@ -39,7 +39,6 @@ Known issues / Roadmap
* AmountTransposedDigits (reconcile if only two digits are swapped. Dangerous and a special case of AmountDiffuse) * AmountTransposedDigits (reconcile if only two digits are swapped. Dangerous and a special case of AmountDiffuse)
* whatever else we can think of * whatever else we can think of
* add some helpers/examples for using the options field * add some helpers/examples for using the options field
* allow to turn off automatic reconciliations during a specific import
* allow to fiddle with the parameters of configured rules during a specific import * allow to fiddle with the parameters of configured rules during a specific import
Bug Tracker Bug Tracker

1
account_bank_statement_import_auto_reconcile/__openerp__.py

@ -14,6 +14,7 @@
'web_widget_one2many_tags', 'web_widget_one2many_tags',
], ],
"data": [ "data": [
"views/account_bank_statement_import.xml",
"views/account_journal.xml", "views/account_journal.xml",
"views/account_bank_statement_import_auto_reconcile_rule.xml", "views/account_bank_statement_import_auto_reconcile_rule.xml",
'security/ir.model.access.csv', 'security/ir.model.access.csv',

10
account_bank_statement_import_auto_reconcile/models/account_bank_statement_import.py

@ -1,12 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl> # © 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, models
from openerp import _, api, fields, models
class AccountBankStatementImport(models.TransientModel): class AccountBankStatementImport(models.TransientModel):
_inherit = 'account.bank.statement.import' _inherit = 'account.bank.statement.import'
auto_reconcile = fields.Boolean('Auto reconcile', default=True)
@api.model @api.model
def _create_bank_statement(self, stmt_vals): def _create_bank_statement(self, stmt_vals):
statement_id, notifications = super( statement_id, notifications = super(
@ -15,6 +17,12 @@ class AccountBankStatementImport(models.TransientModel):
if not statement_id: if not statement_id:
return statement_id, notifications return statement_id, notifications
statement = self.env['account.bank.statement'].browse(statement_id) statement = self.env['account.bank.statement'].browse(statement_id)
if (
not statement.journal_id
.statement_import_auto_reconcile_rule_ids or
not self.auto_reconcile
):
return statement_id, notifications
reconcile_rules = statement.journal_id\ reconcile_rules = statement.journal_id\
.statement_import_auto_reconcile_rule_ids.mapped( .statement_import_auto_reconcile_rule_ids.mapped(
lambda x: self.env[x.rule_type].new({ lambda x: self.env[x.rule_type].new({

15
account_bank_statement_import_auto_reconcile/views/account_bank_statement_import.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="account_bank_statement_import_view" model="ir.ui.view">
<field name="model">account.bank.statement.import</field>
<field name="inherit_id" ref="account_bank_statement_import.account_bank_statement_import_view" />
<field name="arch" type="xml">
<field name="journal_id" position="after">
<field name="auto_reconcile" attrs="{'invisible': [('hide_journal_field', '=', True)]}" class="oe_inline" />
<label for="auto_reconcile" />
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save