-
-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.0][NEW] account_bank_statement_import_move_line
- Loading branch information
1 parent
45b9d90
commit aed845c
Showing
13 changed files
with
596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
======================================= | ||
Account Bank Statement Import Move Line | ||
======================================= | ||
|
||
This module adds a button to bank statement form view to open a wizard to allow | ||
filtering, selecting and importing lines form journal items into the bank | ||
statement. | ||
|
||
Usage | ||
===== | ||
|
||
#. Go to Invoicing > Dashboard. | ||
#. Create a new bank statement from a bank journal. | ||
#. Click button "Import Journal Items". | ||
#. Select filtering options. | ||
#. Click on button "Add All Move Lines" to auto-select the move lines matching | ||
the selected criteria or click on Add an item to manually select the move | ||
lines filtered by the criteria. | ||
#. Click on button "Create Statement Lines". | ||
|
||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/174/10.0 | ||
|
||
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 smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Luis M. Ontalba luis.martinez@tecnativa.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import models | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Tecnativa - Luis M. Ontalba | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
{ | ||
'name': 'Bank statement import move lines', | ||
'version': '10.0.1.0.0', | ||
'category': 'Accounting', | ||
'author': 'Tecnativa, ' | ||
'Odoo Community Association (OCA)', | ||
'website': 'https://www.tecnativa.com', | ||
'depends': [ | ||
'account', | ||
], | ||
'data': [ | ||
'wizards/account_statement_line_create_view.xml', | ||
'views/account_bank_statement_view.xml', | ||
], | ||
'license': 'AGPL-3', | ||
'installable': True, | ||
'auto_install': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_bank_statement_import_move_line | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2017-07-30 09:48+0000\n" | ||
"PO-Revision-Date: 2017-07-30 09:48+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_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Add All Move Lines" | ||
msgstr "Añadir todas las líneas" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: selection:account.statement.line.create,target_move:0 | ||
msgid "All Entries" | ||
msgstr "Todos los asientos" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: selection:account.statement.line.create,target_move:0 | ||
msgid "All Posted Entries" | ||
msgstr "Todos los asientos confirmados" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_allow_blocked | ||
msgid "Allow Litigation Move Lines" | ||
msgstr "Permitir apuntes en litígio" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_statement_id | ||
msgid "Bank Statement" | ||
msgstr "Extracto bancario" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Cancel" | ||
msgstr "Cancelar" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Choose Move Lines Filter Options" | ||
msgstr "Elegir opciones de filtro de apuntes" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Click on Add All Move Lines to auto-select the move lines matching the above criteria or click on Add an item to manually select the move lines filtered by the above criteria." | ||
msgstr "Clic en Añadir todas las líneas para seleccionar automáticamente las líneas de movimiento que coinciden con los criterios anteriores o clic en Agregar un elemento para seleccionar manualmente las líneas de movimiento filtradas por los criterios anteriores." | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.actions.act_window,name:account_bank_statement_import_move_line.account_statement_line_create_action | ||
msgid "Create Lines from Move Lines" | ||
msgstr "Crear Líneas desde apuntes" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Create Statement Lines" | ||
msgstr "Crear líneas del extracto" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_create_uid | ||
msgid "Created by" | ||
msgstr "Creado por" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_create_date | ||
msgid "Created on" | ||
msgstr "Creado en" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_display_name | ||
msgid "Display Name" | ||
msgstr "Nombre mostrado" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: selection:account.statement.line.create,date_type:0 | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_due_date | ||
msgid "Due Date" | ||
msgstr "Fecha vencimiento" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_id | ||
msgid "ID" | ||
msgstr "ID (identificación)" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.view_bank_statement_form | ||
msgid "Import Journal Items" | ||
msgstr "Importar apuntes contables" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model,name:account_bank_statement_import_move_line.model_account_move_line | ||
msgid "Journal Item" | ||
msgstr "Apunte contable" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_journal_ids | ||
msgid "Journals Filter" | ||
msgstr "Filtro de diarios" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Keep empty for using all journals" | ||
msgstr "Dejar vacío para seleccionar todos los diarios" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create___last_update | ||
msgid "Last Modified on" | ||
msgstr "Última modificación en" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_write_uid | ||
msgid "Last Updated by" | ||
msgstr "Última actualización de" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_write_date | ||
msgid "Last Updated on" | ||
msgstr "Última actualización en" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_invoice | ||
msgid "Linked to an Invoice or Refund" | ||
msgstr "Vinculado a factura o devolución" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: selection:account.statement.line.create,date_type:0 | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_move_date | ||
msgid "Move Date" | ||
msgstr "Fecha del apunte" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_move_line_ids | ||
msgid "Move Lines" | ||
msgstr "Apuntes contables" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_partner_id | ||
msgid "Partner Related" | ||
msgstr "Empresa relacionada" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: code:addons/account_bank_statement_import_move_line/wizards/account_statement_line_create.py:93 | ||
#, python-format | ||
msgid "Select Move Lines to Create Statement" | ||
msgstr "Seleccionar apuntes para crear extracto" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Selected Move Lines to Create Lines" | ||
msgstr "Apuntes seleccionados para crear líneas" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_target_move | ||
msgid "Target Moves" | ||
msgstr "Movimientos destino" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.ui.view,arch_db:account_bank_statement_import_move_line.account_statement_line_create_view_form | ||
msgid "Total Residual" | ||
msgstr "Total Residual" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model.fields,field_description:account_bank_statement_import_move_line.field_account_statement_line_create_date_type | ||
msgid "Type of Date Filter" | ||
msgstr "Tipo de filtro por fecha" | ||
|
||
#. module: account_bank_statement_import_move_line | ||
#: model:ir.model,name:account_bank_statement_import_move_line.model_account_statement_line_create | ||
msgid "Wizard to create statement lines" | ||
msgstr "Asistente para crear líneas de extracto" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import account_move_line |
37 changes: 37 additions & 0 deletions
37
account_bank_statement_import_move_line/models/account_move_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Tecnativa - Luis M. Ontalba | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo import api, models | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
_inherit = 'account.move.line' | ||
|
||
@api.multi | ||
def _prepare_statement_line_vals(self, statement): | ||
self.ensure_one() | ||
assert statement, 'Missing statement' | ||
amount = 0.0 | ||
if self.debit > 0: | ||
amount = self.debit | ||
elif self.credit > 0: | ||
amount = -self.credit | ||
vals = { | ||
'name': self.name or '?', | ||
'amount': amount, | ||
'partner_id': self.partner_id.id, | ||
'statement_id': statement.id, | ||
'ref': self.ref, | ||
'date': self.date_maturity, | ||
'amount_currency': self.amount_currency, | ||
'currency_id': self.currency_id.id, | ||
} | ||
return vals | ||
|
||
@api.multi | ||
def create_statement_line_from_move_line(self, statement): | ||
abslo = self.env['account.bank.statement.line'] | ||
for mline in self: | ||
abslo.create(mline._prepare_statement_line_vals(statement)) | ||
return |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 | ||
|
||
from . import test_account_bank_statement_import_move_line |
74 changes: 74 additions & 0 deletions
74
...unt_bank_statement_import_move_line/tests/test_account_bank_statement_import_move_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Tecnativa - Luis M. Ontalba | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 | ||
|
||
from odoo.tests import common | ||
from odoo import fields | ||
|
||
|
||
class TestAccountBankStatementImportMoveLine(common.SavepointCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(TestAccountBankStatementImportMoveLine, cls).setUpClass() | ||
cls.account_type = cls.env['account.account.type'].create({ | ||
'name': 'Test Account Type'}) | ||
cls.a_receivable = cls.env['account.account'].create({ | ||
'code': 'TAA', | ||
'name': 'Test Receivable Account', | ||
'internal_type': 'receivable', | ||
'user_type_id': cls.account_type.id, | ||
}) | ||
cls.partner = cls.env['res.partner'].create({ | ||
'name': 'Test Partner 2', | ||
'parent_id': False, | ||
'account_id': cls.a_receivable.id, | ||
}) | ||
cls.journal = cls.env['account.journal'].create({ | ||
'name': 'Test Journal', | ||
'type': 'bank', | ||
}) | ||
cls.invoice = cls.env['account.invoice'].create({ | ||
'name': 'Test Invoice 3', | ||
'partner_id': cls.partner.id, | ||
'type': 'out_invoice', | ||
'journal_id': cls.journal.id, | ||
'invoice_line_ids': [(0, 0, { | ||
'account_id': cls.a_receivable.id, | ||
'name': 'Test line', | ||
'quantity': 1.0, | ||
'price_unit': 100.00, | ||
})], | ||
}) | ||
cls.statement = cls.env['account.bank.statement'].create({ | ||
'journal_id': cls.journal.id}) | ||
|
||
def test_global(self): | ||
self.invoice.action_invoice_open() | ||
self.assertTrue(self.invoice.move_id) | ||
self.invoice.move_id.post() | ||
wizard_o = self.env['account.statement.line.create'] | ||
context = wizard_o._context.copy() | ||
context.update({ | ||
'active_model': 'account.bank.statement', | ||
'active_id': self.statement.id, | ||
}) | ||
wizard = wizard_o.with_context(context).create({ | ||
'statement_id': self.statement.id, | ||
'partner_id': self.partner.id, | ||
'journal_ids': [(4, self.journal.id)], | ||
'allow_blocked': True, | ||
'date_type': 'move', | ||
'move_date': fields.Date.today(), | ||
'invoice': False, | ||
}) | ||
wizard.populate() | ||
self.assertTrue(len(wizard.move_line_ids), 2) | ||
wizard.invoice = True | ||
wizard.move_line_filters_change() | ||
wizard.populate() | ||
self.assertTrue(len(wizard.move_line_ids), 1) | ||
line = wizard.move_line_ids[0] | ||
self.assertEqual(line.debit, self.invoice.amount_total) | ||
wizard.create_statement_lines() | ||
line = self.statement.line_ids[0] | ||
self.assertEqual(line.amount, self.invoice.amount_total) |
Oops, something went wrong.