diff --git a/account_set_reconcilable/README.rst b/account_set_reconcilable/README.rst new file mode 100644 index 00000000..e6bec561 --- /dev/null +++ b/account_set_reconcilable/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +======================== +Account Set Reconcilable +======================== + +Allows to set as reconcilable a non reconcilable account that already have journal items. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/98/11.0 + + +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 smash it by providing detailed and welcomed feedback. + + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Miquel Raïch + +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. 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..7ec0f6bd --- /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": "11.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/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..9386c8a9 --- /dev/null +++ b/account_set_reconcilable/models/account_account.py @@ -0,0 +1,31 @@ +# © 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): + reconcile = False + if vals.get('reconcile', False) and not self.env.context.get( + 'set_reconcilable', False): + reconcile = vals.pop('reconcile') + rec = super(AccountAccount, self).write(vals=vals) + if reconcile: + moves_lines = self.env['account.move.line'].search( + [('account_id', 'in', self.ids)]) + for account in self: + lines = moves_lines.filtered( + lambda line: line.account_id == account) + if lines: + t_account = account.copy() + lines.write({'account_id': t_account.id}) + account.with_context(set_reconcilable=True).write( + {'reconcile': reconcile}) + lines.write({'account_id': account.id}) + lines._amount_residual() + t_account.unlink() + return rec 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