diff --git a/account_import_line_multicurrency_extension/README.rst b/account_import_line_multicurrency_extension/README.rst new file mode 100644 index 000000000..83208839e --- /dev/null +++ b/account_import_line_multicurrency_extension/README.rst @@ -0,0 +1,56 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Account Import Line Multi Currency Extension +============================================ + +* Improve the view of the import invoice wizard in the bank statement form in order to display more relevant columns. Especially if you work in multi-currency and handle partial payment. + +* A column 'Journal currency symbol' has been added just after the amount column to avoid confusion from end-users -> When the bank journal is in foreign currency then the amount column must be filled in that currency. + +* When importing lines in currencies amount, amount currency and currency are now correctly handled + +A check has been added when pressing 'Reconcile' button: no zero amount are accepted. (since it is obviously an user error) + + +The following feature have been moved in `bank_statement_import_invoices_fix` +* When lines are imported the reference goes to the communication field (instead of reference of the bank statement line) in order to have a default proposal from the system during the reconciliation process. + + +Configuration +============= + +Nothing + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +`here `_. + + +Credits +======= + +Contributors +------------ + +* Vincent renaville + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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 http://odoo-community.org. diff --git a/account_import_line_multicurrency_extension/__init__.py b/account_import_line_multicurrency_extension/__init__.py new file mode 100644 index 000000000..563ca038e --- /dev/null +++ b/account_import_line_multicurrency_extension/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Vincent Renaville (Camptocamp) +# Copyright 2015 Camptocamp SA +# +# 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 . +# +############################################################################## +from . import models diff --git a/account_import_line_multicurrency_extension/__openerp__.py b/account_import_line_multicurrency_extension/__openerp__.py new file mode 100644 index 000000000..161de8b6d --- /dev/null +++ b/account_import_line_multicurrency_extension/__openerp__.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Vincent Renaville (Camptocamp) +# Copyright 2015 Camptocamp SA +# +# 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 . +# +############################################################################## +{'name': 'Bank Statement Multi currency Extension', + 'summary': 'Add an improved view for move line import in bank statement', + 'version': '1.1', + 'author': "Camptocamp,Odoo Community Association (OCA)", + 'maintainter': 'Camptocamp', + 'category': 'Accounting', + 'depends': ['account'], + 'website': 'http://www.camptocamp.com', + 'data': ['view/account_statement_from_invoice_view.xml', + 'view/bank_statement_view.xml', + ], + 'tests': [], + 'installable': True, + 'license': 'AGPL-3', + } diff --git a/account_import_line_multicurrency_extension/i18n/account_import_line_multicurrency_extension.pot b/account_import_line_multicurrency_extension/i18n/account_import_line_multicurrency_extension.pot new file mode 100644 index 000000000..b8a56be51 --- /dev/null +++ b/account_import_line_multicurrency_extension/i18n/account_import_line_multicurrency_extension.pot @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_import_line_multicurrency_extension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-14 14:13+0000\n" +"PO-Revision-Date: 2015-07-14 14:13+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_import_line_multicurrency_extension +#: code:addons/account_import_line_multicurrency_extension/models/bank_statement.py:41 +#, python-format +msgid "Amount on line %s is not set. \n" +"" +msgstr "" + +#. module: account_import_line_multicurrency_extension +#: model:ir.model,name:account_import_line_multicurrency_extension.model_account_bank_statement +msgid "Bank Statement" +msgstr "" + +#. module: account_import_line_multicurrency_extension +#: model:ir.model,name:account_import_line_multicurrency_extension.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "" + +#. module: account_import_line_multicurrency_extension +#: model:ir.model,name:account_import_line_multicurrency_extension.model_account_statement_from_invoice_lines +msgid "Entries by Statement from Invoices" +msgstr "" + +#. module: account_import_line_multicurrency_extension +#: code:addons/account_import_line_multicurrency_extension/models/bank_statement.py:44 +#, python-format +msgid "Error on bank statement: \n" +" %s" +msgstr "" + +#. module: account_import_line_multicurrency_extension +#: view:account.move.line:account_import_line_multicurrency_extension.view_move_line_tree_bank_statement +#: view:account.statement.from.invoice.lines:account_import_line_multicurrency_extension.view_account_statement_from_invoice_lines_over +msgid "Move lines" +msgstr "" + +#. module: account_import_line_multicurrency_extension +#: view:account.bank.statement:account_import_line_multicurrency_extension.view_bank_statement_form +msgid "Reconcile" +msgstr "" + diff --git a/account_import_line_multicurrency_extension/models/__init__.py b/account_import_line_multicurrency_extension/models/__init__.py new file mode 100644 index 000000000..38ae6104b --- /dev/null +++ b/account_import_line_multicurrency_extension/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Vincent Renaville (Camptocamp) +# Copyright 2015 Camptocamp SA +# +# 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 . +# +############################################################################## +from . import bank_statement +from . import account_statement_from_invoice diff --git a/account_import_line_multicurrency_extension/models/account_statement_from_invoice.py b/account_import_line_multicurrency_extension/models/account_statement_from_invoice.py new file mode 100644 index 000000000..82daa1899 --- /dev/null +++ b/account_import_line_multicurrency_extension/models/account_statement_from_invoice.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Vincent Renaville (Camptocamp) +# Copyright 2015 Camptocamp SA +# +# 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 . +# +############################################################################## +from openerp import models, api + + +class account_statement_from_invoice_lines(models.TransientModel): + """ + Generate Entries by Statement from Invoices + """ + _inherit = "account.statement.from.invoice.lines" + + @api.multi + def populate_statement(self): + statement_id = self.env.context.get('statement_id', False) + if not statement_id or not self.line_ids: + return {'type': 'ir.actions.act_window_close'} + + statement_obj = self.env['account.bank.statement'] + statement_line_obj = self.env['account.bank.statement.line'] + statement = statement_obj.browse(statement_id) + line_date = statement.date + # Get the currency on the company if not set on the journal + if statement.journal_id.currency: + from_currency_id = statement.journal_id.currency + else: + from_currency_id = self.env.user.company_id.currency_id + + # for each selected move lines + for line in self.line_ids: + if line.invoice and line.invoice.currency_id == from_currency_id: + amount = line.amount_residual_currency + amount_currency = 0.0 + else: + if statement.journal_id.currency: + from_currency_id = statement.journal_id.currency + else: + from_currency_id = self.env.user.company_id.currency_id + amount = from_currency_id.with_context(date=line_date).compute( + line.amount_residual_currency, + line.invoice.currency_id) + amount_currency = line.amount_residual_currency + # we test how to apply sign + if line.journal_id.type in ['sale_refund', 'purchase']: + amount_currency = -amount_currency + amount = -amount + ctx = {} + ctx.update({'move_line_ids': [line.id], + 'invoice_id': line.invoice.id}) + + statement_line_obj.with_context(ctx).create({ + 'name': line.name or '?', + 'amount': amount, + 'partner_id': line.partner_id.id, + 'statement_id': statement_id, + 'ref': line.ref, + 'date': statement.date, + 'amount_currency': amount_currency, + 'currency_id': line.currency_id.id, + }) + return {'type': 'ir.actions.act_window_close'} diff --git a/account_import_line_multicurrency_extension/models/bank_statement.py b/account_import_line_multicurrency_extension/models/bank_statement.py new file mode 100644 index 000000000..490100a5a --- /dev/null +++ b/account_import_line_multicurrency_extension/models/bank_statement.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Vincent Renaville (Camptocamp) +# Copyright 2015 Camptocamp SA +# +# 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 . +# +############################################################################## +from openerp import models, fields, api, exceptions, _ + + +class AccountBankStatementLine(models.Model): + _inherit = "account.bank.statement.line" + + currency_symbol = fields.Char( + string='Journal Currency', + related='statement_id.currency.symbol', readonly=True) + + +class AccountBankStatement(models.Model): + _inherit = "account.bank.statement" + + @api.multi + def check_line_amount_zero(self): + self.ensure_one() + msg = '' + for line in self.line_ids: + if not line.amount: + msg += _('Amount on line %s is not set. \n') % (line.name) + if msg: + raise exceptions.Warning( + _("Error on bank statement: \n %s") % msg) + # dispatch to reconciliation interface + action = self.env.ref( + 'account.action_bank_reconcile_bank_statements') + return { + 'name': action.name, + 'tag': action.tag, + 'context': { + 'statement_ids': self.ids, + }, + 'type': 'ir.actions.client', + } diff --git a/account_import_line_multicurrency_extension/view/account_statement_from_invoice_view.xml b/account_import_line_multicurrency_extension/view/account_statement_from_invoice_view.xml new file mode 100644 index 000000000..1af9547a2 --- /dev/null +++ b/account_import_line_multicurrency_extension/view/account_statement_from_invoice_view.xml @@ -0,0 +1,50 @@ + + + + + + account.move.line.tree.bank.statement + account.move.line + + + + + + + + + + + + + + + + + account.statement.from.invoice.lines.form.over + account.statement.from.invoice.lines + + + + + + + + + + + + + + + + + + + + + + + diff --git a/account_import_line_multicurrency_extension/view/bank_statement_view.xml b/account_import_line_multicurrency_extension/view/bank_statement_view.xml new file mode 100644 index 000000000..3b50bed52 --- /dev/null +++ b/account_import_line_multicurrency_extension/view/bank_statement_view.xml @@ -0,0 +1,22 @@ + + + + + + account.bank.statement.form.inherit + account.bank.statement + form + + + + + + +