diff --git a/account_partner_reconcile/README.rst b/account_partner_reconcile/README.rst new file mode 100644 index 00000000..e69de29b diff --git a/account_partner_reconcile/__init__.py b/account_partner_reconcile/__init__.py new file mode 100755 index 00000000..149f4e4f --- /dev/null +++ b/account_partner_reconcile/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/account_partner_reconcile/__manifest__.py b/account_partner_reconcile/__manifest__.py new file mode 100644 index 00000000..e66de9ce --- /dev/null +++ b/account_partner_reconcile/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Account Partner Reconciliation', + 'summary': 'Allows run reconciliation only for same partner', + 'version': '10.0.1.0.0', + 'depends': ['account'], + 'author': 'Camptocamp, Odoo Community Association (OCA)', + 'website': 'http://www.github.com/OCA/account-reconcile', + 'category': 'Finance', + 'license': 'AGPL-3', + 'data': [ + 'report/account_move_lines_report.xml' + ], + 'installable': True, +} diff --git a/account_partner_reconcile/models/__init__.py b/account_partner_reconcile/models/__init__.py new file mode 100755 index 00000000..dceb779d --- /dev/null +++ b/account_partner_reconcile/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import account_move_line diff --git a/account_partner_reconcile/models/account_move_line.py b/account_partner_reconcile/models/account_move_line.py new file mode 100644 index 00000000..e21efa16 --- /dev/null +++ b/account_partner_reconcile/models/account_move_line.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, models, _ +from odoo.exceptions import UserError + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + @api.multi + def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False): + # to be consistent with parent method + if not self: + return True + partners = set() + for line in self: + if (line.account_id.internal_type in ('receivable', 'payable')): + partners.add(line.partner_id.id) + if len(partners) > 1: + raise UserError(_('The partner has to be the same on all lines for receivable and payable accounts!')) + if len(partners) and not all([l.partner_id for l in self]): + raise UserError(_('You cannot match entries with and without partner!')) + return super(AccountMoveLine, self).reconcile(writeoff_acc_id, writeoff_journal_id) diff --git a/account_partner_reconcile/readme/DESCRIPTION.rst b/account_partner_reconcile/readme/DESCRIPTION.rst new file mode 100644 index 00000000..78f50fd7 --- /dev/null +++ b/account_partner_reconcile/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Prohibits items reconcilation for different partners, and items with partner and +without it. diff --git a/account_partner_reconcile/static/description/icon.png b/account_partner_reconcile/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_partner_reconcile/static/description/icon.png differ diff --git a/account_partner_reconcile/static/description/index.html b/account_partner_reconcile/static/description/index.html new file mode 100644 index 00000000..876a1f6c --- /dev/null +++ b/account_partner_reconcile/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.

+
+
+
+ +