Browse Source

[12.0][ADD] add account_bank_statement_import_bypass_check module

12.0
Tonow-c2c 5 years ago
parent
commit
cf814f2611
  1. 86
      account_bank_statement_import_bypass_check/README.rst
  2. 1
      account_bank_statement_import_bypass_check/__init__.py
  3. 21
      account_bank_statement_import_bypass_check/__manifest__.py
  4. 26
      account_bank_statement_import_bypass_check/i18n/fr.po
  5. 3
      account_bank_statement_import_bypass_check/readme/CONTRIBUTORS.rst
  6. 1
      account_bank_statement_import_bypass_check/readme/DESCRIPTION.rst
  7. 7
      account_bank_statement_import_bypass_check/readme/USAGE.rst
  8. 1
      account_bank_statement_import_bypass_check/wizard/__init__.py
  9. 56
      account_bank_statement_import_bypass_check/wizard/account_bank_statement_import.py
  10. 24
      account_bank_statement_import_bypass_check/wizard/account_bank_statement_import_view.xml

86
account_bank_statement_import_bypass_check/README.rst

@ -0,0 +1,86 @@
==================================
Bypass check Bank statement import
==================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github
:target: https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_bypass_check
:alt: OCA/bank-statement-import
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-statement-import-12-0/bank-statement-import-12-0-account_bank_statement_import_bypass_check
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/174/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds a check button to bypass the check if account of this statement is not the same as the journal.
**Table of contents**
.. contents::
:local:
Usage
=====
#. Go to Accounting > Dashboard.
#. On one bank click button "Import".
#. Upload on statement file.
#. Click button "Import".
#. If account of this statement is not the same as the journal in your file:
#. You have error message printed in the wizard + the possibility do force the import.
#. You can check the boolean field and retry the import if you want.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_bypass_check%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Camptocamp
Contributors
~~~~~~~~~~~~
* `Camptoamp <https://www.camptocamp.com>`_:
* Thomas Nowicki
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_bypass_check>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

1
account_bank_statement_import_bypass_check/__init__.py

@ -0,0 +1 @@
from . import wizard

21
account_bank_statement_import_bypass_check/__manifest__.py

@ -0,0 +1,21 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Bypass check Bank statement import',
'version': '12.0.1.0.0',
'category': 'Accounting',
'summary': 'Allow possibility to bypass check in Bank statement import',
'author': 'Camptocamp, '
'Odoo Community Association (OCA)',
'maintainer': 'Camptocamp',
'website': 'https://github.com/OCA/bank-statement-import',
'depends': [
'account_bank_statement_import',
],
'data': [
'wizard/account_bank_statement_import_view.xml',
],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
}

26
account_bank_statement_import_bypass_check/i18n/fr.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_bypass_check
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 10:54+0000\n"
"PO-Revision-Date: 2019-12-12 10:54+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_bank_statement_import_bypass_check
#: model:ir.model.fields,field_description:account_bank_statement_import_bypass_check.field_account_bank_statement_import__force_journal
msgid "Do you want to force this import ?"
msgstr "Voulez-vous forcer cet import ?"
#. module: account_bank_statement_import_bypass_check
#: model:ir.model,name:account_bank_statement_import_bypass_check.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Import d'un relevé bancaire"

3
account_bank_statement_import_bypass_check/readme/CONTRIBUTORS.rst

@ -0,0 +1,3 @@
* `Camptoamp <https://www.camptocamp.com>`_:
* Thomas Nowicki

1
account_bank_statement_import_bypass_check/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This module adds a check button to bypass the check if account of this statement is not the same as the journal.

7
account_bank_statement_import_bypass_check/readme/USAGE.rst

@ -0,0 +1,7 @@
#. Go to Accounting > Dashboard.
#. On one bank click button "Import".
#. Upload on statement file.
#. Click button "Import".
#. If account of this statement is not the same as the journal in your file:
#. You have error message printed in the wizard + the possibility do force the import.
#. You can check the boolean field and retry the import if you want.

1
account_bank_statement_import_bypass_check/wizard/__init__.py

@ -0,0 +1 @@
from . import account_bank_statement_import

56
account_bank_statement_import_bypass_check/wizard/account_bank_statement_import.py

@ -0,0 +1,56 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import base64
import logging
from odoo import api, fields, models
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
_inherit = "account.bank.statement.import"
check_journal = fields.Boolean(default=True)
check_message = fields.Char(readonly=True)
force_journal = fields.Boolean(
string="Do you want to force this import ?", default=False
)
@api.multi
def import_file(self):
""" Override to make the import in 2 step.
To provide to user possiblity to bypass the journal check.
"""
self.ensure_one()
currency_code, account_number, stmts_vals = self.with_context(
active_id=self.ids[0]
)._parse_file(base64.b64decode(self.data_file))
if self.check_journal:
try:
self._find_additional_data(currency_code, account_number)
# _find_additional_data() call _check_journal_bank_account()
# so the self.check_journal value can evolve
except UserError as u_error:
if not self.check_journal:
msg = u_error.args[0]
_logger.info(msg)
self.check_message = str(msg)
action = self.env.ref(
"account_bank_statement_import."
"action_account_bank_statement_import"
).read([])[0]
action["res_id"] = self.id
return action
return super().import_file()
def _check_journal_bank_account(self, journal, account_number):
check = super()._check_journal_bank_account(journal, account_number)
if self.check_journal:
self.check_journal = False
if self.force_journal:
return True
return check

24
account_bank_statement_import_bypass_check/wizard/account_bank_statement_import_view.xml

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<odoo>
<record id="account_bank_statement_import_view" model="ir.ui.view">
<field name="name">account.bank.statement.import.view</field>
<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="filename" position="after">
<field name="check_journal" invisible="1"/>
<group attrs="{'invisible': [('check_journal', '=', True)]}">
<field name="check_message"
nolabel="1"
colspan="2"
style="color: red;"/>
<field name="force_journal"/>
</group>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save