diff --git a/account_reconciliation_widget_limit_aml/__init__.py b/account_reconciliation_widget_limit_aml/__init__.py new file mode 100644 index 0000000000..2d89283f33 --- /dev/null +++ b/account_reconciliation_widget_limit_aml/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2023 Valentin Vinagre +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/account_reconciliation_widget_limit_aml/__manifest__.py b/account_reconciliation_widget_limit_aml/__manifest__.py new file mode 100644 index 0000000000..7c5885bd67 --- /dev/null +++ b/account_reconciliation_widget_limit_aml/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2023 Valentin Vinagre +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Account Reconciliation Widget Limit AML", + "version": "14.0.1.0.0", + "category": "Accounting", + "license": "AGPL-3", + "summary": "Filter all account move lines in reconciliation view", + "author": "Sygel, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-reconcile", + "depends": ["account_reconciliation_widget"], + "data": ["views/res_config_settings_views.xml"], + "installable": True, +} diff --git a/account_reconciliation_widget_limit_aml/models/__init__.py b/account_reconciliation_widget_limit_aml/models/__init__.py new file mode 100644 index 0000000000..01e4d0b7b2 --- /dev/null +++ b/account_reconciliation_widget_limit_aml/models/__init__.py @@ -0,0 +1,7 @@ +# Copyright 2023 Valentin Vinagre +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_company +from . import res_config_settings +from . import reconciliation_widget diff --git a/account_reconciliation_widget_limit_aml/models/reconciliation_widget.py b/account_reconciliation_widget_limit_aml/models/reconciliation_widget.py new file mode 100644 index 0000000000..639cb97c9a --- /dev/null +++ b/account_reconciliation_widget_limit_aml/models/reconciliation_widget.py @@ -0,0 +1,41 @@ +# Copyright 2023 Valentin Vinagre +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models +from odoo.osv import expression + + +class AccountReconciliation(models.AbstractModel): + _inherit = "account.reconciliation.widget" + + @api.model + def _domain_move_lines_for_reconciliation( + self, + st_line, + aml_accounts, + partner_id, + excluded_ids=None, + search_str=False, + mode="rp", + ): + domain = super()._domain_move_lines_for_reconciliation( + st_line, aml_accounts, partner_id, excluded_ids, search_str, mode + ) + if ( + st_line.company_id.account_bank_reconciliation_start_all_aml + and st_line.company_id.account_bank_reconciliation_start + ): + domain = expression.AND( + [ + domain, + [ + ( + "date", + ">=", + st_line.company_id.account_bank_reconciliation_start, + ) + ], + ] + ) + return domain diff --git a/account_reconciliation_widget_limit_aml/models/res_company.py b/account_reconciliation_widget_limit_aml/models/res_company.py new file mode 100644 index 0000000000..39ad43a83e --- /dev/null +++ b/account_reconciliation_widget_limit_aml/models/res_company.py @@ -0,0 +1,13 @@ +# Copyright 2023 Valentin Vinagre +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + account_bank_reconciliation_start_all_aml = fields.Boolean( + string="Filter all account move lines" + ) diff --git a/account_reconciliation_widget_limit_aml/models/res_config_settings.py b/account_reconciliation_widget_limit_aml/models/res_config_settings.py new file mode 100644 index 0000000000..610214fe0f --- /dev/null +++ b/account_reconciliation_widget_limit_aml/models/res_config_settings.py @@ -0,0 +1,13 @@ +# Copyright 2023 Valentin Vinagre +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + account_bank_reconciliation_start_all_aml = fields.Boolean( + related="company_id.account_bank_reconciliation_start_all_aml", readonly=False + ) diff --git a/account_reconciliation_widget_limit_aml/readme/CONTRIBUTORS.rst b/account_reconciliation_widget_limit_aml/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..ebaf1e8cda --- /dev/null +++ b/account_reconciliation_widget_limit_aml/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Valentin Vinagre +* Manuel Regidor diff --git a/account_reconciliation_widget_limit_aml/readme/DESCRIPTION.rst b/account_reconciliation_widget_limit_aml/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..054cdf5080 --- /dev/null +++ b/account_reconciliation_widget_limit_aml/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds the option to filter all the account move lines by date in the reconciliation view, not only those coming from payments. diff --git a/account_reconciliation_widget_limit_aml/readme/USAGE.rst b/account_reconciliation_widget_limit_aml/readme/USAGE.rst new file mode 100644 index 0000000000..45f80a3404 --- /dev/null +++ b/account_reconciliation_widget_limit_aml/readme/USAGE.rst @@ -0,0 +1,2 @@ +Go to Invoicing --> Configuration --> Settings +Check the "Filter all account move lines" checkbox. When checked, all the account move lines will be filtered by the selected date. diff --git a/account_reconciliation_widget_limit_aml/static/description/icon.png b/account_reconciliation_widget_limit_aml/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/account_reconciliation_widget_limit_aml/static/description/icon.png differ diff --git a/account_reconciliation_widget_limit_aml/views/res_config_settings_views.xml b/account_reconciliation_widget_limit_aml/views/res_config_settings_views.xml new file mode 100644 index 0000000000..00a12c0a2d --- /dev/null +++ b/account_reconciliation_widget_limit_aml/views/res_config_settings_views.xml @@ -0,0 +1,26 @@ + + + + + + res.config.settings + + + +
+ +
+
+
+
+
diff --git a/setup/account_reconciliation_widget_limit_aml/odoo/addons/account_reconciliation_widget_limit_aml b/setup/account_reconciliation_widget_limit_aml/odoo/addons/account_reconciliation_widget_limit_aml new file mode 120000 index 0000000000..1b311bd3a5 --- /dev/null +++ b/setup/account_reconciliation_widget_limit_aml/odoo/addons/account_reconciliation_widget_limit_aml @@ -0,0 +1 @@ +../../../../account_reconciliation_widget_limit_aml \ No newline at end of file diff --git a/setup/account_reconciliation_widget_limit_aml/setup.py b/setup/account_reconciliation_widget_limit_aml/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/account_reconciliation_widget_limit_aml/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)