diff --git a/account_set_reconcilable/README.rst b/account_set_reconcilable/README.rst new file mode 100644 index 00000000..cb7ff6cb --- /dev/null +++ b/account_set_reconcilable/README.rst @@ -0,0 +1,73 @@ +======================== +Account Set Reconcilable +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Faccount--reconcile-lightgray.png?logo=github + :target: https://github.com/OCA/account-reconcile/tree/12.0/account_set_reconcilable + :alt: OCA/account-reconcile +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-reconcile-12-0/account-reconcile-12-0-account_set_reconcilable + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/98/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Allows to set as reconcilable a non reconcilable account that already have journal items. + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Miquel Raïch + +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/account-reconcile `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_set_reconcilable/__init__.py b/account_set_reconcilable/__init__.py new file mode 100755 index 00000000..4b76c7b2 --- /dev/null +++ b/account_set_reconcilable/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/account_set_reconcilable/__manifest__.py b/account_set_reconcilable/__manifest__.py new file mode 100644 index 00000000..60a2ff4f --- /dev/null +++ b/account_set_reconcilable/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Account Set Reconcilable", + "summary": "Allows to set as reconcilable a non reconcilable" + "account that already have journal items.", + "version": "12.0.1.0.0", + "depends": ["account"], + "author": "Eficent, Odoo Community Association (OCA)", + "website": "http://www.github.com/OCA/account-reconcile", + "category": "Finance", + 'license': 'AGPL-3', + 'installable': True, +} diff --git a/account_set_reconcilable/i18n/account_set_reconcilable.pot b/account_set_reconcilable/i18n/account_set_reconcilable.pot new file mode 100644 index 00000000..45aec839 --- /dev/null +++ b/account_set_reconcilable/i18n/account_set_reconcilable.pot @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_set_reconcilable +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \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_set_reconcilable +#: model:ir.model,name:account_set_reconcilable.model_account_account +msgid "Account" +msgstr "" + diff --git a/account_set_reconcilable/models/__init__.py b/account_set_reconcilable/models/__init__.py new file mode 100755 index 00000000..187b10d4 --- /dev/null +++ b/account_set_reconcilable/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import account_account diff --git a/account_set_reconcilable/models/account_account.py b/account_set_reconcilable/models/account_account.py new file mode 100644 index 00000000..a16dfd16 --- /dev/null +++ b/account_set_reconcilable/models/account_account.py @@ -0,0 +1,25 @@ +# © 2018 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class AccountAccount(models.Model): + _inherit = "account.account" + + @api.multi + def write(self, vals): + if 'reconcile' in vals: + rec_val = vals.get('reconcile') + move_lines = self.env['account.move.line'].search( + [('account_id', 'in', self.ids)]) + if move_lines: + for acc in self: + acc_move_lines = move_lines.filtered( + lambda line: line.account_id == acc) + self.env.cr.execute( + "UPDATE account_account SET reconcile=%s " + "WHERE id=%s", (rec_val, acc.id,)) + acc_move_lines._amount_residual() + vals.pop('reconcile') + return super(AccountAccount, self).write(vals=vals) diff --git a/account_set_reconcilable/readme/CONTRIBUTORS.rst b/account_set_reconcilable/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..2e34e218 --- /dev/null +++ b/account_set_reconcilable/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Miquel Raïch diff --git a/account_set_reconcilable/readme/DESCRIPTION.rst b/account_set_reconcilable/readme/DESCRIPTION.rst new file mode 100644 index 00000000..294916d4 --- /dev/null +++ b/account_set_reconcilable/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Allows to set as reconcilable a non reconcilable account that already have journal items. diff --git a/account_set_reconcilable/static/description/icon.png b/account_set_reconcilable/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_set_reconcilable/static/description/icon.png differ diff --git a/account_set_reconcilable/static/description/index.html b/account_set_reconcilable/static/description/index.html new file mode 100644 index 00000000..65efef65 --- /dev/null +++ b/account_set_reconcilable/static/description/index.html @@ -0,0 +1,419 @@ + + + + + + +Account Set Reconcilable + + + +
+

Account Set Reconcilable

+ + +

Beta License: AGPL-3 OCA/account-reconcile Translate me on Weblate Try me on Runbot

+

Allows to set as reconcilable a non reconcilable account that already have journal items.

+

Table of contents

+ +
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Eficent
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/account-reconcile project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_set_reconcilable/tests/__init__.py b/account_set_reconcilable/tests/__init__.py new file mode 100644 index 00000000..93a76bb5 --- /dev/null +++ b/account_set_reconcilable/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_account_set_reconcilable diff --git a/account_set_reconcilable/tests/test_account_set_reconcilable.py b/account_set_reconcilable/tests/test_account_set_reconcilable.py new file mode 100644 index 00000000..883382a1 --- /dev/null +++ b/account_set_reconcilable/tests/test_account_set_reconcilable.py @@ -0,0 +1,39 @@ +# © 2018 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestAccountSetReconcilable(TransactionCase): + + def setUp(self): + super(TestAccountSetReconcilable, self).setUp() + account_account_model = self.env['account.account'] + account_move_model = self.env['account.move'] + journal = self.env['account.journal'].search( + [('type', '=', 'general')], limit=1) + self.account1 = account_account_model.create({ + 'name': 'account_test', + 'code': 'code_test', + 'reconcile': False, + 'user_type_id': self.env.ref( + 'account.data_account_type_current_liabilities').id, + }) + self.move1 = account_move_model.create({ + 'journal_id': journal.id, + 'ref': 'move_test', + 'line_ids': [(0, 0, { + 'name': 'foo', + 'debit': 10, + 'account_id': self.account1.id, + }), (0, 0, { + 'name': 'bar', + 'credit': 10, + 'account_id': self.account1.id, + })] + }) + + def test_write(self): + self.account1.reconcile = True + self.assertTrue(self.account1.reconcile) + self.assertEqual(len(self.move1.line_ids), 2)