odoo-addon-account-financial-report 16.0.1.5.4.4__py3-none-any.whl → 16.0.1.6.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of odoo-addon-account-financial-report might be problematic. Click here for more details.

Files changed (46) hide show
  1. odoo/addons/account_financial_report/README.rst +36 -1
  2. odoo/addons/account_financial_report/__manifest__.py +4 -1
  3. odoo/addons/account_financial_report/i18n/account_financial_report.pot +105 -5
  4. odoo/addons/account_financial_report/i18n/ar.po +129 -12
  5. odoo/addons/account_financial_report/i18n/ca.po +133 -13
  6. odoo/addons/account_financial_report/i18n/de.po +133 -16
  7. odoo/addons/account_financial_report/i18n/es.po +142 -13
  8. odoo/addons/account_financial_report/i18n/es_AR.po +133 -13
  9. odoo/addons/account_financial_report/i18n/es_MX.po +105 -5
  10. odoo/addons/account_financial_report/i18n/fr.po +133 -16
  11. odoo/addons/account_financial_report/i18n/fr_CH.po +129 -12
  12. odoo/addons/account_financial_report/i18n/fr_FR.po +133 -13
  13. odoo/addons/account_financial_report/i18n/hr.po +133 -13
  14. odoo/addons/account_financial_report/i18n/hr_HR.po +105 -5
  15. odoo/addons/account_financial_report/i18n/it.po +133 -16
  16. odoo/addons/account_financial_report/i18n/ja.po +105 -5
  17. odoo/addons/account_financial_report/i18n/nl.po +133 -16
  18. odoo/addons/account_financial_report/i18n/nl_NL.po +105 -5
  19. odoo/addons/account_financial_report/i18n/pt.po +129 -9
  20. odoo/addons/account_financial_report/i18n/pt_BR.po +133 -16
  21. odoo/addons/account_financial_report/i18n/ro.po +133 -16
  22. odoo/addons/account_financial_report/i18n/sv.po +133 -13
  23. odoo/addons/account_financial_report/i18n/tr.po +105 -5
  24. odoo/addons/account_financial_report/models/__init__.py +2 -0
  25. odoo/addons/account_financial_report/models/account_age_report_configuration.py +47 -0
  26. odoo/addons/account_financial_report/models/res_config_settings.py +14 -0
  27. odoo/addons/account_financial_report/readme/CONFIGURE.rst +26 -0
  28. odoo/addons/account_financial_report/readme/CONTRIBUTORS.rst +1 -0
  29. odoo/addons/account_financial_report/readme/DESCRIPTION.rst +4 -0
  30. odoo/addons/account_financial_report/report/aged_partner_balance.py +69 -8
  31. odoo/addons/account_financial_report/report/aged_partner_balance_xlsx.py +145 -104
  32. odoo/addons/account_financial_report/report/templates/aged_partner_balance.xml +428 -333
  33. odoo/addons/account_financial_report/security/ir.model.access.csv +2 -0
  34. odoo/addons/account_financial_report/security/security.xml +10 -0
  35. odoo/addons/account_financial_report/static/description/index.html +45 -21
  36. odoo/addons/account_financial_report/tests/__init__.py +1 -0
  37. odoo/addons/account_financial_report/tests/test_age_report_configuration.py +41 -0
  38. odoo/addons/account_financial_report/tests/test_aged_partner_balance.py +88 -7
  39. odoo/addons/account_financial_report/view/account_age_report_configuration_views.xml +41 -0
  40. odoo/addons/account_financial_report/view/res_config_settings_views.xml +56 -0
  41. odoo/addons/account_financial_report/wizard/aged_partner_balance_wizard.py +4 -0
  42. odoo/addons/account_financial_report/wizard/aged_partner_balance_wizard_view.xml +2 -3
  43. {odoo_addon_account_financial_report-16.0.1.5.4.4.dist-info → odoo_addon_account_financial_report-16.0.1.6.0.1.dist-info}/METADATA +37 -2
  44. {odoo_addon_account_financial_report-16.0.1.5.4.4.dist-info → odoo_addon_account_financial_report-16.0.1.6.0.1.dist-info}/RECORD +46 -39
  45. {odoo_addon_account_financial_report-16.0.1.5.4.4.dist-info → odoo_addon_account_financial_report-16.0.1.6.0.1.dist-info}/WHEEL +0 -0
  46. {odoo_addon_account_financial_report-16.0.1.5.4.4.dist-info → odoo_addon_account_financial_report-16.0.1.6.0.1.dist-info}/top_level.txt +0 -0
@@ -52,6 +52,11 @@ msgstr ""
52
52
  msgid "<b>Taxes summary</b>"
53
53
  msgstr "<b>Vergi Özeti</b>"
54
54
 
55
+ #. module: account_financial_report
56
+ #: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form
57
+ msgid "<span class=\"o_form_label\">Intervals configuration</span>"
58
+ msgstr ""
59
+
55
60
  #. module: account_financial_report
56
61
  #: model_terms:ir.ui.view,arch_db:account_financial_report.aged_partner_balance_wizard
57
62
  #: model_terms:ir.ui.view,arch_db:account_financial_report.general_ledger_wizard
@@ -92,6 +97,11 @@ msgstr ""
92
97
  msgid "Account"
93
98
  msgstr "Hesap"
94
99
 
100
+ #. module: account_financial_report
101
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__account_age_report_config_id
102
+ msgid "Account Age Report Config"
103
+ msgstr ""
104
+
95
105
  #. module: account_financial_report
96
106
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__account_code_from
97
107
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__account_code_from
@@ -153,11 +163,16 @@ msgstr "Merkezileştirmeyi Etkinleştir"
153
163
  msgid "Additional Filtering"
154
164
  msgstr "İlave Filtreleme"
155
165
 
166
+ #. module: account_financial_report
167
+ #: model:ir.actions.act_window,name:account_financial_report.action_aged_partner_report_configuration
168
+ msgid "Age Partner Report Configuration"
169
+ msgstr ""
170
+
156
171
  #. module: account_financial_report
157
172
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines
158
173
  msgid ""
159
174
  "Age ≤ 120\n"
160
- " d."
175
+ " d."
161
176
  msgstr ""
162
177
 
163
178
  #. module: account_financial_report
@@ -171,7 +186,7 @@ msgstr ""
171
186
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines
172
187
  msgid ""
173
188
  "Age ≤ 30\n"
174
- " d."
189
+ " d."
175
190
  msgstr ""
176
191
 
177
192
  #. module: account_financial_report
@@ -185,7 +200,7 @@ msgstr ""
185
200
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines
186
201
  msgid ""
187
202
  "Age ≤ 60\n"
188
- " d."
203
+ " d."
189
204
  msgstr ""
190
205
 
191
206
  #. module: account_financial_report
@@ -199,7 +214,7 @@ msgstr ""
199
214
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines
200
215
  msgid ""
201
216
  "Age ≤ 90\n"
202
- " d."
217
+ " d."
203
218
  msgstr ""
204
219
 
205
220
  #. module: account_financial_report
@@ -418,6 +433,7 @@ msgstr "Kod"
418
433
  #. module: account_financial_report
419
434
  #. odoo-python
420
435
  #: code:addons/account_financial_report/report/journal_ledger_xlsx.py:0
436
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__company_id
421
437
  #: model:ir.model.fields,field_description:account_financial_report.field_account_financial_report_abstract_wizard__company_id
422
438
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__company_id
423
439
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__company_id
@@ -435,6 +451,18 @@ msgid "Compute accounts"
435
451
  msgstr ""
436
452
 
437
453
  #. module: account_financial_report
454
+ #: model:ir.model,name:account_financial_report.model_res_config_settings
455
+ msgid "Config Settings"
456
+ msgstr ""
457
+
458
+ #. module: account_financial_report
459
+ #: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form
460
+ msgid "Configurations"
461
+ msgstr ""
462
+
463
+ #. module: account_financial_report
464
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__create_uid
465
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__create_uid
438
466
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__create_uid
439
467
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__create_uid
440
468
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__create_uid
@@ -445,6 +473,8 @@ msgid "Created by"
445
473
  msgstr "Oluşturan"
446
474
 
447
475
  #. module: account_financial_report
476
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__create_date
477
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__create_date
448
478
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__create_date
449
479
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__create_date
450
480
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__create_date
@@ -633,6 +663,8 @@ msgid "Detail Taxes"
633
663
  msgstr "Vergi Detayları"
634
664
 
635
665
  #. module: account_financial_report
666
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__display_name
667
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__display_name
636
668
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__display_name
637
669
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__display_name
638
670
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__display_name
@@ -920,6 +952,12 @@ msgstr ""
920
952
  msgid "Grouped By"
921
953
  msgstr "Gruplanma"
922
954
 
955
+ #. module: account_financial_report
956
+ #: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form
957
+ msgid ""
958
+ "Here you can set the intervals that will appear on the Aged Partner Balance."
959
+ msgstr ""
960
+
923
961
  #. module: account_financial_report
924
962
  #. odoo-python
925
963
  #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0
@@ -949,6 +987,8 @@ msgid "Hierarchy Levels to display"
949
987
  msgstr "Görüntülenecek Hiyerarşi Düzeyleri"
950
988
 
951
989
  #. module: account_financial_report
990
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__id
991
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__id
952
992
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__id
953
993
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__id
954
994
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__id
@@ -965,6 +1005,18 @@ msgid ""
965
1005
  "webkit one only), only centralized amounts per period."
966
1006
  msgstr ""
967
1007
 
1008
+ #. module: account_financial_report
1009
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__inferior_limit
1010
+ msgid "Inferior Limit"
1011
+ msgstr ""
1012
+
1013
+ #. module: account_financial_report
1014
+ #. odoo-python
1015
+ #: code:addons/account_financial_report/models/account_age_report_configuration.py:0
1016
+ #, python-format
1017
+ msgid "Inferior Limit must be greather than zero"
1018
+ msgstr ""
1019
+
968
1020
  #. module: account_financial_report
969
1021
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header
970
1022
  msgid ""
@@ -990,6 +1042,12 @@ msgstr ""
990
1042
  msgid "Initial balance"
991
1043
  msgstr "Açılış Bakiyesi"
992
1044
 
1045
+ #. module: account_financial_report
1046
+ #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__age_partner_config_id
1047
+ #: model:ir.model.fields,field_description:account_financial_report.field_res_config_settings__default_age_partner_config_id
1048
+ msgid "Intervals configuration"
1049
+ msgstr ""
1050
+
993
1051
  #. module: account_financial_report
994
1052
  #. odoo-python
995
1053
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1059,6 +1117,8 @@ msgid "Journals"
1059
1117
  msgstr "Yevmiyeler"
1060
1118
 
1061
1119
  #. module: account_financial_report
1120
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration____last_update
1121
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line____last_update
1062
1122
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard____last_update
1063
1123
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard____last_update
1064
1124
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard____last_update
@@ -1069,6 +1129,8 @@ msgid "Last Modified on"
1069
1129
  msgstr "Son Düzenleme"
1070
1130
 
1071
1131
  #. module: account_financial_report
1132
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__write_uid
1133
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__write_uid
1072
1134
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__write_uid
1073
1135
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__write_uid
1074
1136
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__write_uid
@@ -1079,6 +1141,8 @@ msgid "Last Updated by"
1079
1141
  msgstr "Son Güncelleyen"
1080
1142
 
1081
1143
  #. module: account_financial_report
1144
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__write_date
1145
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__write_date
1082
1146
  #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__write_date
1083
1147
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__write_date
1084
1148
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__write_date
@@ -1110,6 +1174,11 @@ msgstr "Seviye %s"
1110
1174
  msgid "Limit hierarchy levels"
1111
1175
  msgstr "Hiyerarşi Düzeylerini Sınırla"
1112
1176
 
1177
+ #. module: account_financial_report
1178
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__line_ids
1179
+ msgid "Line"
1180
+ msgstr ""
1181
+
1113
1182
  #. module: account_financial_report
1114
1183
  #. odoo-python
1115
1184
  #: code:addons/account_financial_report/report/general_ledger.py:0
@@ -1119,6 +1188,16 @@ msgstr "Hiyerarşi Düzeylerini Sınırla"
1119
1188
  msgid "Missing Partner"
1120
1189
  msgstr ""
1121
1190
 
1191
+ #. module: account_financial_report
1192
+ #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1193
+ msgid "Model to set interval lines for Age partner balance report"
1194
+ msgstr ""
1195
+
1196
+ #. module: account_financial_report
1197
+ #: model:ir.model,name:account_financial_report.model_account_age_report_configuration
1198
+ msgid "Model to set intervals for Age partner balance report"
1199
+ msgstr ""
1200
+
1122
1201
  #. module: account_financial_report
1123
1202
  #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__move_target
1124
1203
  msgid "Move Target"
@@ -1129,10 +1208,19 @@ msgstr "Hedef Harketler"
1129
1208
  msgid "Moves"
1130
1209
  msgstr "Hareketler"
1131
1210
 
1211
+ #. module: account_financial_report
1212
+ #. odoo-python
1213
+ #: code:addons/account_financial_report/models/account_age_report_configuration.py:0
1214
+ #, python-format
1215
+ msgid "Must complete Configuration Lines"
1216
+ msgstr ""
1217
+
1132
1218
  #. module: account_financial_report
1133
1219
  #. odoo-python
1134
1220
  #: code:addons/account_financial_report/report/journal_ledger_xlsx.py:0
1135
1221
  #: code:addons/account_financial_report/report/vat_report_xlsx.py:0
1222
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__name
1223
+ #: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__name
1136
1224
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_all_taxes
1137
1225
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_taxes
1138
1226
  #: model_terms:ir.ui.view,arch_db:account_financial_report.report_vat_report_base
@@ -1140,6 +1228,14 @@ msgstr "Hareketler"
1140
1228
  msgid "Name"
1141
1229
  msgstr "Adı"
1142
1230
 
1231
+ #. module: account_financial_report
1232
+ #. odoo-python
1233
+ #: code:addons/account_financial_report/models/account_age_report_configuration.py:0
1234
+ #: model:ir.model.constraint,message:account_financial_report.constraint_account_age_report_configuration_line_unique_name_config_combination
1235
+ #, python-format
1236
+ msgid "Name must be unique per report configuration"
1237
+ msgstr ""
1238
+
1143
1239
  #. module: account_financial_report
1144
1240
  #. odoo-python
1145
1241
  #: code:addons/account_financial_report/report/vat_report_xlsx.py:0
@@ -1196,6 +1292,11 @@ msgstr "İşlenmemiş"
1196
1292
  msgid "Not due"
1197
1293
  msgstr "Vadesi Gelmemiş"
1198
1294
 
1295
+ #. module: account_financial_report
1296
+ #: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form
1297
+ msgid "OCA Aged Report Configuration"
1298
+ msgstr ""
1299
+
1199
1300
  #. module: account_financial_report
1200
1301
  #: model:ir.ui.menu,name:account_financial_report.menu_oca_reports
1201
1302
  msgid "OCA accounting reports"
@@ -1810,7 +1911,6 @@ msgid "future"
1810
1911
  msgstr ""
1811
1912
 
1812
1913
  #. module: account_financial_report
1813
- #: model_terms:ir.ui.view,arch_db:account_financial_report.aged_partner_balance_wizard
1814
1914
  #: model_terms:ir.ui.view,arch_db:account_financial_report.general_ledger_wizard
1815
1915
  #: model_terms:ir.ui.view,arch_db:account_financial_report.journal_ledger_wizard
1816
1916
  #: model_terms:ir.ui.view,arch_db:account_financial_report.open_items_wizard
@@ -1,4 +1,6 @@
1
+ from . import account_age_report_configuration
1
2
  from . import account_group
2
3
  from . import account
3
4
  from . import account_move_line
4
5
  from . import ir_actions_report
6
+ from . import res_config_settings
@@ -0,0 +1,47 @@
1
+ # Copyright 2023 Ernesto García
2
+ # Copyright 2023 Carolina Fernandez
3
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4
+ from odoo import _, api, fields, models
5
+ from odoo.exceptions import ValidationError
6
+
7
+
8
+ class AccountAgeReportConfiguration(models.Model):
9
+ _name = "account.age.report.configuration"
10
+ _description = "Model to set intervals for Age partner balance report"
11
+
12
+ name = fields.Char(required=True)
13
+ company_id = fields.Many2one(
14
+ "res.company", default=lambda self: self.env.company, readonly=True
15
+ )
16
+ line_ids = fields.One2many(
17
+ "account.age.report.configuration.line", "account_age_report_config_id"
18
+ )
19
+
20
+ @api.constrains("line_ids")
21
+ def _check_line_ids(self):
22
+ for rec in self:
23
+ if not rec.line_ids:
24
+ raise ValidationError(_("Must complete Configuration Lines"))
25
+
26
+
27
+ class AccountAgeReportConfigurationLine(models.Model):
28
+ _name = "account.age.report.configuration.line"
29
+ _description = "Model to set interval lines for Age partner balance report"
30
+
31
+ name = fields.Char(required=True)
32
+ account_age_report_config_id = fields.Many2one("account.age.report.configuration")
33
+ inferior_limit = fields.Integer()
34
+
35
+ @api.constrains("inferior_limit")
36
+ def _check_inferior_limit(self):
37
+ for rec in self:
38
+ if rec.inferior_limit <= 0:
39
+ raise ValidationError(_("Inferior Limit must be greather than zero"))
40
+
41
+ _sql_constraints = [
42
+ (
43
+ "unique_name_config_combination",
44
+ "UNIQUE(name,account_age_report_config_id)",
45
+ _("Name must be unique per report configuration"),
46
+ )
47
+ ]
@@ -0,0 +1,14 @@
1
+ # Copyright 2023 Tecnativa - Carolina Fernandez
2
+ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3
+
4
+ from odoo import fields, models
5
+
6
+
7
+ class ResConfigSettings(models.TransientModel):
8
+ _inherit = "res.config.settings"
9
+
10
+ default_age_partner_config_id = fields.Many2one(
11
+ "account.age.report.configuration",
12
+ string="Intervals configuration",
13
+ default_model="aged.partner.balance.report.wizard",
14
+ )
@@ -0,0 +1,26 @@
1
+ To configure dynamic intervals for Aged Partner Balance you need to:
2
+
3
+ Go on 'Settings' -> 'Invoicing' -> 'OCA Aged Report Configuration'.
4
+
5
+ Click on option 'Configurations' and create new record.
6
+
7
+ Create new interval.
8
+ The name established on line will be the column to display in Aged Partner Balance.
9
+ Inferior limit established on line is the interval
10
+
11
+ Example of configuration inferior limit:
12
+
13
+ -> 15
14
+ -> 30
15
+ -> 60
16
+
17
+ It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+.
18
+
19
+ Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged Partner Balance'
20
+
21
+ When wizard is open, you need to select your interval configuration and print report.
22
+
23
+ If you want to get default interval configuration any time you wish to print Aged Partner Report,
24
+ you can set default interval configuration per company in:
25
+
26
+ 'Settings' -> 'Invoicing' -> 'OCA Aged Report Configuration'.
@@ -24,6 +24,7 @@
24
24
  * João Marques
25
25
  * Alexandre D. Díaz
26
26
  * Víctor Martínez
27
+ * Carolina Fernandez
27
28
 
28
29
  * `Sygel <https://www.sygel.es>`__:
29
30
 
@@ -14,3 +14,7 @@ currency used in account move lines is properly shown.
14
14
 
15
15
  In case that in an account has not been configured a second currency foreign
16
16
  currency balances are not available.
17
+
18
+ Invoicing / Settings / Invoicing / OCA Aged Report Configuration you will be able to set
19
+ dynamic intervals that will appear on the Aged Partner Balance.
20
+ For further information, check CONFIGURE.rst
@@ -25,6 +25,8 @@ class AgedPartnerBalanceReport(models.AbstractModel):
25
25
  ag_pb_data[acc_id]["90_days"] = 0.0
26
26
  ag_pb_data[acc_id]["120_days"] = 0.0
27
27
  ag_pb_data[acc_id]["older"] = 0.0
28
+ for interval_line in self.env.context["age_partner_config"].line_ids:
29
+ ag_pb_data[acc_id][interval_line] = 0.0
28
30
  return ag_pb_data
29
31
 
30
32
  @api.model
@@ -39,6 +41,8 @@ class AgedPartnerBalanceReport(models.AbstractModel):
39
41
  ag_pb_data[acc_id][prt_id]["120_days"] = 0.0
40
42
  ag_pb_data[acc_id][prt_id]["older"] = 0.0
41
43
  ag_pb_data[acc_id][prt_id]["move_lines"] = []
44
+ for interval_line in self.env.context["age_partner_config"].line_ids:
45
+ ag_pb_data[acc_id][prt_id][interval_line] = 0.0
42
46
  return ag_pb_data
43
47
 
44
48
  @api.model
@@ -47,6 +51,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
47
51
  ):
48
52
  ag_pb_data[acc_id]["residual"] += residual
49
53
  ag_pb_data[acc_id][prt_id]["residual"] += residual
54
+ interval_lines = self.env.context["age_partner_config"].line_ids
50
55
  today = date_at_object
51
56
  if not due_date or today <= due_date:
52
57
  ag_pb_data[acc_id]["current"] += residual
@@ -66,8 +71,29 @@ class AgedPartnerBalanceReport(models.AbstractModel):
66
71
  else:
67
72
  ag_pb_data[acc_id]["older"] += residual
68
73
  ag_pb_data[acc_id][prt_id]["older"] += residual
74
+ days_difference = abs((today - due_date).days)
75
+ for index, line in enumerate(interval_lines):
76
+ lower_limit = 0 if not index else interval_lines[index - 1].inferior_limit
77
+ next_line = interval_lines[index] if index < len(interval_lines) else None
78
+ interval_range = self._get_values_for_range_intervals(
79
+ lower_limit, next_line.inferior_limit
80
+ )
81
+ if (
82
+ days_difference in interval_range
83
+ or days_difference == line.inferior_limit
84
+ ):
85
+ ag_pb_data[acc_id][line] += residual
86
+ ag_pb_data[acc_id][prt_id][line] += residual
87
+ break
69
88
  return ag_pb_data
70
89
 
90
+ def _get_values_for_range_intervals(self, num1, num2):
91
+ min_num = min(num1, num2)
92
+ max_num = max(num1, num2)
93
+ if abs(num2 - num1) == 1:
94
+ return [max_num]
95
+ return list(range(min_num + 1, max_num))
96
+
71
97
  def _get_account_partial_reconciled(self, company_id, date_at_object):
72
98
  domain = [("max_date", ">", date_at_object), ("company_id", "=", company_id)]
73
99
  fields = [
@@ -235,6 +261,9 @@ class AgedPartnerBalanceReport(models.AbstractModel):
235
261
  "older": 0.0,
236
262
  }
237
263
  )
264
+ interval_lines = self.env.context["age_partner_config"].line_ids
265
+ for interval_line in interval_lines:
266
+ ml[interval_line] = 0.0
238
267
  due_date = ml["due_date"]
239
268
  amount = ml["residual"]
240
269
  today = date_at_object
@@ -250,6 +279,19 @@ class AgedPartnerBalanceReport(models.AbstractModel):
250
279
  ml["120_days"] += amount
251
280
  else:
252
281
  ml["older"] += amount
282
+ days_difference = abs((today - due_date).days)
283
+ for index, interval_line in enumerate(interval_lines):
284
+ lower_limit = 0 if not index else interval_lines[index - 1].inferior_limit
285
+ next_line = interval_lines[index] if index < len(interval_lines) else None
286
+ interval_range = self._get_values_for_range_intervals(
287
+ lower_limit, next_line.inferior_limit
288
+ )
289
+ if (
290
+ days_difference in interval_range
291
+ or days_difference == interval_line.inferior_limit
292
+ ):
293
+ ml[interval_line] += amount
294
+ break
253
295
 
254
296
  def _create_account_list(
255
297
  self,
@@ -261,6 +303,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
261
303
  date_at_oject,
262
304
  ):
263
305
  aged_partner_data = []
306
+ interval_lines = self.env.context["age_partner_config"].line_ids
264
307
  for account in accounts_data.values():
265
308
  acc_id = account["id"]
266
309
  account.update(
@@ -275,6 +318,8 @@ class AgedPartnerBalanceReport(models.AbstractModel):
275
318
  "partners": [],
276
319
  }
277
320
  )
321
+ for interval_line in interval_lines:
322
+ account[interval_line] = ag_pb_data[acc_id][interval_line]
278
323
  for prt_id in ag_pb_data[acc_id]:
279
324
  if isinstance(prt_id, int):
280
325
  partner = {
@@ -287,6 +332,10 @@ class AgedPartnerBalanceReport(models.AbstractModel):
287
332
  "120_days": ag_pb_data[acc_id][prt_id]["120_days"],
288
333
  "older": ag_pb_data[acc_id][prt_id]["older"],
289
334
  }
335
+ for interval_line in interval_lines:
336
+ partner[interval_line] = ag_pb_data[acc_id][prt_id][
337
+ interval_line
338
+ ]
290
339
  if show_move_line_details:
291
340
  move_lines = []
292
341
  for ml in ag_pb_data[acc_id][prt_id]["move_lines"]:
@@ -306,6 +355,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
306
355
 
307
356
  @api.model
308
357
  def _calculate_percent(self, aged_partner_data):
358
+ interval_lines = self.env.context["age_partner_config"].line_ids
309
359
  for account in aged_partner_data:
310
360
  if abs(account["residual"]) > 0.01:
311
361
  total = account["residual"]
@@ -331,6 +381,10 @@ class AgedPartnerBalanceReport(models.AbstractModel):
331
381
  ),
332
382
  }
333
383
  )
384
+ for interval_line in interval_lines:
385
+ account[f"percent_{interval_line.id}"] = abs(
386
+ round((account[interval_line] / total) * 100, 2)
387
+ )
334
388
  else:
335
389
  account.update(
336
390
  {
@@ -342,6 +396,8 @@ class AgedPartnerBalanceReport(models.AbstractModel):
342
396
  "percent_older": 0.0,
343
397
  }
344
398
  )
399
+ for interval_line in interval_lines:
400
+ account[f"percent_{interval_line.id}"] = 0.0
345
401
  return aged_partner_data
346
402
 
347
403
  def _get_report_values(self, docids, data):
@@ -355,12 +411,12 @@ class AgedPartnerBalanceReport(models.AbstractModel):
355
411
  date_from = data["date_from"]
356
412
  only_posted_moves = data["only_posted_moves"]
357
413
  show_move_line_details = data["show_move_line_details"]
358
- (
359
- ag_pb_data,
360
- accounts_data,
361
- partners_data,
362
- journals_data,
363
- ) = self._get_move_lines_data(
414
+ aged_partner_configuration = self.env[
415
+ "account.age.report.configuration"
416
+ ].browse(data["age_partner_config_id"])
417
+ (ag_pb_data, accounts_data, partners_data, journals_data,) = self.with_context(
418
+ age_partner_config=aged_partner_configuration
419
+ )._get_move_lines_data(
364
420
  company_id,
365
421
  account_ids,
366
422
  partner_ids,
@@ -369,7 +425,9 @@ class AgedPartnerBalanceReport(models.AbstractModel):
369
425
  only_posted_moves,
370
426
  show_move_line_details,
371
427
  )
372
- aged_partner_data = self._create_account_list(
428
+ aged_partner_data = self.with_context(
429
+ age_partner_config=aged_partner_configuration
430
+ )._create_account_list(
373
431
  ag_pb_data,
374
432
  accounts_data,
375
433
  partners_data,
@@ -377,7 +435,9 @@ class AgedPartnerBalanceReport(models.AbstractModel):
377
435
  show_move_line_details,
378
436
  date_at_object,
379
437
  )
380
- aged_partner_data = self._calculate_percent(aged_partner_data)
438
+ aged_partner_data = self.with_context(
439
+ age_partner_config=aged_partner_configuration
440
+ )._calculate_percent(aged_partner_data)
381
441
  return {
382
442
  "doc_ids": [wizard_id],
383
443
  "doc_model": "open.items.report.wizard",
@@ -388,6 +448,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
388
448
  "only_posted_moves": only_posted_moves,
389
449
  "aged_partner_balance": aged_partner_data,
390
450
  "show_move_lines_details": show_move_line_details,
451
+ "age_partner_config": aged_partner_configuration,
391
452
  }
392
453
 
393
454
  def _get_ml_fields(self):