odoo-addon-account-financial-report 18.0.1.2.6.3__py3-none-any.whl → 18.0.1.3.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 (33) hide show
  1. odoo/addons/account_financial_report/README.rst +1 -1
  2. odoo/addons/account_financial_report/__manifest__.py +1 -1
  3. odoo/addons/account_financial_report/i18n/account_financial_report.pot +14 -0
  4. odoo/addons/account_financial_report/i18n/ar.po +16 -2
  5. odoo/addons/account_financial_report/i18n/ca.po +14 -0
  6. odoo/addons/account_financial_report/i18n/de.po +14 -0
  7. odoo/addons/account_financial_report/i18n/es.po +15 -1
  8. odoo/addons/account_financial_report/i18n/es_AR.po +14 -0
  9. odoo/addons/account_financial_report/i18n/es_MX.po +14 -0
  10. odoo/addons/account_financial_report/i18n/fr.po +14 -0
  11. odoo/addons/account_financial_report/i18n/fr_CH.po +14 -0
  12. odoo/addons/account_financial_report/i18n/hr.po +14 -0
  13. odoo/addons/account_financial_report/i18n/hr_HR.po +14 -0
  14. odoo/addons/account_financial_report/i18n/it.po +14 -0
  15. odoo/addons/account_financial_report/i18n/ja.po +14 -0
  16. odoo/addons/account_financial_report/i18n/nl.po +14 -0
  17. odoo/addons/account_financial_report/i18n/nl_NL.po +14 -0
  18. odoo/addons/account_financial_report/i18n/pt.po +14 -0
  19. odoo/addons/account_financial_report/i18n/pt_BR.po +14 -0
  20. odoo/addons/account_financial_report/i18n/ro.po +14 -0
  21. odoo/addons/account_financial_report/i18n/sv.po +14 -0
  22. odoo/addons/account_financial_report/i18n/tr.po +14 -0
  23. odoo/addons/account_financial_report/report/open_items.py +29 -25
  24. odoo/addons/account_financial_report/report/open_items_xlsx.py +150 -17
  25. odoo/addons/account_financial_report/report/templates/open_items.xml +176 -50
  26. odoo/addons/account_financial_report/static/description/index.html +1 -1
  27. odoo/addons/account_financial_report/tests/test_open_items.py +30 -0
  28. odoo/addons/account_financial_report/wizard/open_items_wizard.py +18 -0
  29. odoo/addons/account_financial_report/wizard/open_items_wizard_view.xml +1 -0
  30. {odoo_addon_account_financial_report-18.0.1.2.6.3.dist-info → odoo_addon_account_financial_report-18.0.1.3.0.1.dist-info}/METADATA +2 -2
  31. {odoo_addon_account_financial_report-18.0.1.2.6.3.dist-info → odoo_addon_account_financial_report-18.0.1.3.0.1.dist-info}/RECORD +33 -33
  32. {odoo_addon_account_financial_report-18.0.1.2.6.3.dist-info → odoo_addon_account_financial_report-18.0.1.3.0.1.dist-info}/WHEEL +0 -0
  33. {odoo_addon_account_financial_report-18.0.1.2.6.3.dist-info → odoo_addon_account_financial_report-18.0.1.3.0.1.dist-info}/top_level.txt +0 -0
@@ -918,6 +918,7 @@ msgstr "Groepeer boekingen per"
918
918
 
919
919
  #. module: account_financial_report
920
920
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
921
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
921
922
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
922
923
  msgid "Grouped By"
923
924
  msgstr "Gegroepeerd op"
@@ -1137,10 +1138,17 @@ msgstr "Regel"
1137
1138
  #. odoo-python
1138
1139
  #: code:addons/account_financial_report/report/general_ledger.py:0
1139
1140
  #: code:addons/account_financial_report/report/open_items.py:0
1141
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1140
1142
  #: code:addons/account_financial_report/report/trial_balance.py:0
1141
1143
  msgid "Missing Partner"
1142
1144
  msgstr ""
1143
1145
 
1146
+ #. module: account_financial_report
1147
+ #. odoo-python
1148
+ #: code:addons/account_financial_report/report/open_items.py:0
1149
+ msgid "Missing Salesperson"
1150
+ msgstr ""
1151
+
1144
1152
  #. module: account_financial_report
1145
1153
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1146
1154
  msgid "Model to set interval lines for Age partner balance report"
@@ -1335,6 +1343,11 @@ msgstr ""
1335
1343
  msgid "Partner Initial balance"
1336
1344
  msgstr "Relatiebeginsaldo"
1337
1345
 
1346
+ #. module: account_financial_report
1347
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1348
+ msgid "Partner Salesperson"
1349
+ msgstr ""
1350
+
1338
1351
  #. module: account_financial_report
1339
1352
  #. odoo-python
1340
1353
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1357,6 +1370,7 @@ msgstr "Beginbalans partner"
1357
1370
 
1358
1371
  #. module: account_financial_report
1359
1372
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1373
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1360
1374
  msgid "Partners"
1361
1375
  msgstr "Partners"
1362
1376
 
@@ -913,6 +913,7 @@ msgstr ""
913
913
 
914
914
  #. module: account_financial_report
915
915
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
916
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
916
917
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
917
918
  msgid "Grouped By"
918
919
  msgstr ""
@@ -1126,10 +1127,17 @@ msgstr ""
1126
1127
  #. odoo-python
1127
1128
  #: code:addons/account_financial_report/report/general_ledger.py:0
1128
1129
  #: code:addons/account_financial_report/report/open_items.py:0
1130
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1129
1131
  #: code:addons/account_financial_report/report/trial_balance.py:0
1130
1132
  msgid "Missing Partner"
1131
1133
  msgstr ""
1132
1134
 
1135
+ #. module: account_financial_report
1136
+ #. odoo-python
1137
+ #: code:addons/account_financial_report/report/open_items.py:0
1138
+ msgid "Missing Salesperson"
1139
+ msgstr ""
1140
+
1133
1141
  #. module: account_financial_report
1134
1142
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1135
1143
  msgid "Model to set interval lines for Age partner balance report"
@@ -1322,6 +1330,11 @@ msgstr ""
1322
1330
  msgid "Partner Initial balance"
1323
1331
  msgstr ""
1324
1332
 
1333
+ #. module: account_financial_report
1334
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1335
+ msgid "Partner Salesperson"
1336
+ msgstr ""
1337
+
1325
1338
  #. module: account_financial_report
1326
1339
  #. odoo-python
1327
1340
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1344,6 +1357,7 @@ msgstr ""
1344
1357
 
1345
1358
  #. module: account_financial_report
1346
1359
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1360
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1347
1361
  msgid "Partners"
1348
1362
  msgstr ""
1349
1363
 
@@ -917,6 +917,7 @@ msgstr "Agrupar movimentos por"
917
917
 
918
918
  #. module: account_financial_report
919
919
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
920
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
920
921
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
921
922
  msgid "Grouped By"
922
923
  msgstr "Agrupar Por"
@@ -1136,10 +1137,17 @@ msgstr "Linha"
1136
1137
  #. odoo-python
1137
1138
  #: code:addons/account_financial_report/report/general_ledger.py:0
1138
1139
  #: code:addons/account_financial_report/report/open_items.py:0
1140
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1139
1141
  #: code:addons/account_financial_report/report/trial_balance.py:0
1140
1142
  msgid "Missing Partner"
1141
1143
  msgstr "Parceiro em Falta"
1142
1144
 
1145
+ #. module: account_financial_report
1146
+ #. odoo-python
1147
+ #: code:addons/account_financial_report/report/open_items.py:0
1148
+ msgid "Missing Salesperson"
1149
+ msgstr ""
1150
+
1143
1151
  #. module: account_financial_report
1144
1152
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1145
1153
  msgid "Model to set interval lines for Age partner balance report"
@@ -1337,6 +1345,11 @@ msgstr ""
1337
1345
  msgid "Partner Initial balance"
1338
1346
  msgstr "Saldo inicial de Parceiro"
1339
1347
 
1348
+ #. module: account_financial_report
1349
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1350
+ msgid "Partner Salesperson"
1351
+ msgstr ""
1352
+
1340
1353
  #. module: account_financial_report
1341
1354
  #. odoo-python
1342
1355
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1359,6 +1372,7 @@ msgstr "Saldo inicial do parceiro"
1359
1372
 
1360
1373
  #. module: account_financial_report
1361
1374
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1375
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1362
1376
  msgid "Partners"
1363
1377
  msgstr "Parceiros"
1364
1378
 
@@ -914,6 +914,7 @@ msgstr "Agrupar lan??amentos por"
914
914
 
915
915
  #. module: account_financial_report
916
916
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
917
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
917
918
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
918
919
  msgid "Grouped By"
919
920
  msgstr "Agrupado Por"
@@ -1133,10 +1134,17 @@ msgstr "Linha"
1133
1134
  #. odoo-python
1134
1135
  #: code:addons/account_financial_report/report/general_ledger.py:0
1135
1136
  #: code:addons/account_financial_report/report/open_items.py:0
1137
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1136
1138
  #: code:addons/account_financial_report/report/trial_balance.py:0
1137
1139
  msgid "Missing Partner"
1138
1140
  msgstr ""
1139
1141
 
1142
+ #. module: account_financial_report
1143
+ #. odoo-python
1144
+ #: code:addons/account_financial_report/report/open_items.py:0
1145
+ msgid "Missing Salesperson"
1146
+ msgstr ""
1147
+
1140
1148
  #. module: account_financial_report
1141
1149
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1142
1150
  msgid "Model to set interval lines for Age partner balance report"
@@ -1331,6 +1339,11 @@ msgstr ""
1331
1339
  msgid "Partner Initial balance"
1332
1340
  msgstr "Saldo inicial do parceiro"
1333
1341
 
1342
+ #. module: account_financial_report
1343
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1344
+ msgid "Partner Salesperson"
1345
+ msgstr ""
1346
+
1334
1347
  #. module: account_financial_report
1335
1348
  #. odoo-python
1336
1349
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1353,6 +1366,7 @@ msgstr "Saldo inicial do Parceiro"
1353
1366
 
1354
1367
  #. module: account_financial_report
1355
1368
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1369
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1356
1370
  msgid "Partners"
1357
1371
  msgstr "Parceiros"
1358
1372
 
@@ -914,6 +914,7 @@ msgstr "Intr??ri de grup dup??"
914
914
 
915
915
  #. module: account_financial_report
916
916
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
917
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
917
918
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
918
919
  msgid "Grouped By"
919
920
  msgstr ""
@@ -1134,10 +1135,17 @@ msgstr "Linie"
1134
1135
  #. odoo-python
1135
1136
  #: code:addons/account_financial_report/report/general_ledger.py:0
1136
1137
  #: code:addons/account_financial_report/report/open_items.py:0
1138
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1137
1139
  #: code:addons/account_financial_report/report/trial_balance.py:0
1138
1140
  msgid "Missing Partner"
1139
1141
  msgstr ""
1140
1142
 
1143
+ #. module: account_financial_report
1144
+ #. odoo-python
1145
+ #: code:addons/account_financial_report/report/open_items.py:0
1146
+ msgid "Missing Salesperson"
1147
+ msgstr ""
1148
+
1141
1149
  #. module: account_financial_report
1142
1150
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1143
1151
  msgid "Model to set interval lines for Age partner balance report"
@@ -1330,6 +1338,11 @@ msgstr ""
1330
1338
  msgid "Partner Initial balance"
1331
1339
  msgstr "Sold ini??ial partener"
1332
1340
 
1341
+ #. module: account_financial_report
1342
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1343
+ msgid "Partner Salesperson"
1344
+ msgstr ""
1345
+
1333
1346
  #. module: account_financial_report
1334
1347
  #. odoo-python
1335
1348
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1352,6 +1365,7 @@ msgstr ""
1352
1365
 
1353
1366
  #. module: account_financial_report
1354
1367
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1368
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1355
1369
  msgid "Partners"
1356
1370
  msgstr ""
1357
1371
 
@@ -925,6 +925,7 @@ msgstr "Gruppinlägg efter"
925
925
 
926
926
  #. module: account_financial_report
927
927
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
928
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
928
929
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
929
930
  msgid "Grouped By"
930
931
  msgstr "Grupperad efter"
@@ -1145,10 +1146,17 @@ msgstr "Linje"
1145
1146
  #. odoo-python
1146
1147
  #: code:addons/account_financial_report/report/general_ledger.py:0
1147
1148
  #: code:addons/account_financial_report/report/open_items.py:0
1149
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1148
1150
  #: code:addons/account_financial_report/report/trial_balance.py:0
1149
1151
  msgid "Missing Partner"
1150
1152
  msgstr "Saknad partner"
1151
1153
 
1154
+ #. module: account_financial_report
1155
+ #. odoo-python
1156
+ #: code:addons/account_financial_report/report/open_items.py:0
1157
+ msgid "Missing Salesperson"
1158
+ msgstr ""
1159
+
1152
1160
  #. module: account_financial_report
1153
1161
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1154
1162
  msgid "Model to set interval lines for Age partner balance report"
@@ -1343,6 +1351,11 @@ msgstr ""
1343
1351
  msgid "Partner Initial balance"
1344
1352
  msgstr "Kund initial balans"
1345
1353
 
1354
+ #. module: account_financial_report
1355
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1356
+ msgid "Partner Salesperson"
1357
+ msgstr ""
1358
+
1346
1359
  #. module: account_financial_report
1347
1360
  #. odoo-python
1348
1361
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1365,6 +1378,7 @@ msgstr "Partnerns initiala balans"
1365
1378
 
1366
1379
  #. module: account_financial_report
1367
1380
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1381
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1368
1382
  msgid "Partners"
1369
1383
  msgstr "Partner"
1370
1384
 
@@ -926,6 +926,7 @@ msgstr "Giriş gruplama"
926
926
 
927
927
  #. module: account_financial_report
928
928
  #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__grouped_by
929
+ #: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__grouped_by
929
930
  #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__grouped_by
930
931
  msgid "Grouped By"
931
932
  msgstr "Gruplanma"
@@ -1145,10 +1146,17 @@ msgstr "Satır"
1145
1146
  #. odoo-python
1146
1147
  #: code:addons/account_financial_report/report/general_ledger.py:0
1147
1148
  #: code:addons/account_financial_report/report/open_items.py:0
1149
+ #: code:addons/account_financial_report/report/open_items_xlsx.py:0
1148
1150
  #: code:addons/account_financial_report/report/trial_balance.py:0
1149
1151
  msgid "Missing Partner"
1150
1152
  msgstr "Eksik İş Ortağı"
1151
1153
 
1154
+ #. module: account_financial_report
1155
+ #. odoo-python
1156
+ #: code:addons/account_financial_report/report/open_items.py:0
1157
+ msgid "Missing Salesperson"
1158
+ msgstr ""
1159
+
1152
1160
  #. module: account_financial_report
1153
1161
  #: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line
1154
1162
  msgid "Model to set interval lines for Age partner balance report"
@@ -1343,6 +1351,11 @@ msgstr ""
1343
1351
  msgid "Partner Initial balance"
1344
1352
  msgstr "İş Ortağı Başlangıç bakiyesi"
1345
1353
 
1354
+ #. module: account_financial_report
1355
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__salesperson
1356
+ msgid "Partner Salesperson"
1357
+ msgstr ""
1358
+
1346
1359
  #. module: account_financial_report
1347
1360
  #. odoo-python
1348
1361
  #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0
@@ -1365,6 +1378,7 @@ msgstr "Ortak başlangıç bakiyesi"
1365
1378
 
1366
1379
  #. module: account_financial_report
1367
1380
  #: model:ir.model.fields.selection,name:account_financial_report.selection__general_ledger_report_wizard__grouped_by__partners
1381
+ #: model:ir.model.fields.selection,name:account_financial_report.selection__open_items_report_wizard__grouped_by__partners
1368
1382
  msgid "Partners"
1369
1383
  msgstr "İş Ortakları"
1370
1384
 
@@ -1,5 +1,6 @@
1
1
  # © 2016 Julien Coux (Camptocamp)
2
2
  # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
3
+ # Copyright 2024 Tecnativa - Carolina Fernandez
3
4
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
5
 
5
6
  import operator
@@ -66,6 +67,7 @@ class OpenItemsReport(models.AbstractModel):
66
67
  only_posted_moves,
67
68
  company_id,
68
69
  date_from,
70
+ grouped_by,
69
71
  ):
70
72
  domain = self._get_move_lines_domain_not_reconciled(
71
73
  company_id, account_ids, partner_ids, only_posted_moves, date_from
@@ -75,7 +77,7 @@ class OpenItemsReport(models.AbstractModel):
75
77
  domain=domain, fields=ml_fields
76
78
  )
77
79
  journals_ids = set()
78
- partners_ids = set()
80
+ group_ids = set()
79
81
  partners_data = {}
80
82
  if date_at_object < date.today():
81
83
  (
@@ -119,29 +121,27 @@ class OpenItemsReport(models.AbstractModel):
119
121
  journals_ids.add(move_line["journal_id"][0])
120
122
  acc_id = move_line["account_id"][0]
121
123
  # Partners data
122
- if move_line["partner_id"]:
123
- prt_id = move_line["partner_id"][0]
124
- prt_name = move_line["partner_id"][1]
124
+ partner = self.env["res.partner"]
125
+ if move_line.get("partner_id"):
126
+ partner = self.env["res.partner"].browse(move_line["partner_id"][0])
127
+ if grouped_by == "salesperson":
128
+ user = partner.user_id
129
+ group_id = user.id or 0
130
+ group_name = user.name or _("Missing Salesperson")
125
131
  else:
126
- prt_id = 0
127
- prt_name = _("Missing Partner")
128
- if prt_id not in partners_ids:
129
- partners_data.update({prt_id: {"id": prt_id, "name": prt_name}})
130
- partners_ids.add(prt_id)
131
-
132
+ group_id = partner.id or 0
133
+ group_name = partner.name or _("Missing Partner")
134
+ if group_id not in group_ids:
135
+ partners_data.update({group_id: {"id": group_id, "name": group_name}})
136
+ group_ids.add(group_id)
132
137
  # Move line update
133
- original = 0
134
-
135
138
  if not float_is_zero(move_line["credit"], precision_digits=2):
136
139
  original = move_line["credit"] * (-1)
137
- if not float_is_zero(move_line["debit"], precision_digits=2):
140
+ else:
138
141
  original = move_line["debit"]
139
142
 
140
143
  if move_line["ref"] == move_line["name"]:
141
- if move_line["ref"]:
142
- ref_label = move_line["ref"]
143
- else:
144
- ref_label = ""
144
+ ref_label = move_line["ref"] or ""
145
145
  elif not move_line["ref"]:
146
146
  ref_label = move_line["name"]
147
147
  elif not move_line["name"]:
@@ -155,8 +155,8 @@ class OpenItemsReport(models.AbstractModel):
155
155
  "date_maturity": move_line["date_maturity"]
156
156
  and move_line["date_maturity"].strftime("%d/%m/%Y"),
157
157
  "original": original,
158
- "partner_id": prt_id,
159
- "partner_name": prt_name,
158
+ "partner_id": partner.id or 0,
159
+ "partner_name": partner.name or "",
160
160
  "ref_label": ref_label,
161
161
  "journal_id": move_line["journal_id"][0],
162
162
  "move_name": move_line["move_id"][1],
@@ -172,12 +172,12 @@ class OpenItemsReport(models.AbstractModel):
172
172
 
173
173
  # Open Items Move Lines Data
174
174
  if acc_id not in open_items_move_lines_data.keys():
175
- open_items_move_lines_data[acc_id] = {prt_id: [move_line]}
175
+ open_items_move_lines_data[acc_id] = {group_id: [move_line]}
176
176
  else:
177
- if prt_id not in open_items_move_lines_data[acc_id].keys():
178
- open_items_move_lines_data[acc_id][prt_id] = [move_line]
177
+ if group_id not in open_items_move_lines_data[acc_id].keys():
178
+ open_items_move_lines_data[acc_id][group_id] = [move_line]
179
179
  else:
180
- open_items_move_lines_data[acc_id][prt_id].append(move_line)
180
+ open_items_move_lines_data[acc_id][group_id].append(move_line)
181
181
  journals_data = self._get_journals_data(list(journals_ids))
182
182
  accounts_data = self._get_accounts_data(open_items_move_lines_data.keys())
183
183
  return (
@@ -236,7 +236,9 @@ class OpenItemsReport(models.AbstractModel):
236
236
  move_lines = []
237
237
  for move_line in open_items_move_lines_data[acc_id][prt_id]:
238
238
  move_lines += [move_line]
239
- move_lines = sorted(move_lines, key=lambda k: (k["date"]))
239
+ move_lines = sorted(
240
+ move_lines, key=lambda k: (k["date"], k["partner_id"])
241
+ )
240
242
  new_open_items[acc_id][prt_id] = move_lines
241
243
  return new_open_items
242
244
 
@@ -251,7 +253,7 @@ class OpenItemsReport(models.AbstractModel):
251
253
  date_from = data["date_from"]
252
254
  only_posted_moves = data["only_posted_moves"]
253
255
  show_partner_details = data["show_partner_details"]
254
-
256
+ grouped_by = data["grouped_by"]
255
257
  (
256
258
  move_lines_data,
257
259
  partners_data,
@@ -265,6 +267,7 @@ class OpenItemsReport(models.AbstractModel):
265
267
  only_posted_moves,
266
268
  company_id,
267
269
  date_from,
270
+ grouped_by,
268
271
  )
269
272
 
270
273
  total_amount = self._calculate_amounts(open_items_move_lines_data)
@@ -290,6 +293,7 @@ class OpenItemsReport(models.AbstractModel):
290
293
  "accounts_data": accounts_data,
291
294
  "total_amount": total_amount,
292
295
  "Open_Items": open_items_move_lines_data,
296
+ "grouped_by": grouped_by,
293
297
  }
294
298
 
295
299
  def _get_ml_fields(self):
@@ -101,11 +101,126 @@ class OpenItemsXslx(models.AbstractModel):
101
101
  def _get_col_pos_final_balance_label(self):
102
102
  return 5
103
103
 
104
- def _generate_report_content(self, workbook, report, data, report_data):
105
- res_data = self.env[
106
- "report.account_financial_report.open_items"
107
- ]._get_report_values(report, data)
108
- # For each account
104
+ def _calculate_amounts_by_partner(self, account_id, open_items_move_lines_data):
105
+ total_amount = {}
106
+ for line in open_items_move_lines_data:
107
+ partner_id_key = line["partner_id"]
108
+ if account_id not in total_amount:
109
+ total_amount[account_id] = {}
110
+ if partner_id_key not in total_amount[account_id]:
111
+ total_amount[account_id][partner_id_key] = {"residual": 0.0}
112
+ total_amount[account_id][partner_id_key]["residual"] += line[
113
+ "amount_residual"
114
+ ]
115
+ return total_amount
116
+
117
+ def _generate_report_content_by_salesperson(
118
+ self, workbook, report, data, report_data, res_data
119
+ ):
120
+ Open_items = res_data["Open_Items"]
121
+ accounts_data = res_data["accounts_data"]
122
+ partners_data = res_data["partners_data"]
123
+ journals_data = res_data["journals_data"]
124
+ total_amount = res_data["total_amount"]
125
+
126
+ for partner_id in partners_data.keys():
127
+ # Create a new sheet for each partner
128
+ partner_totals = {}
129
+ partner_name = partners_data[partner_id]["name"]
130
+ new_sheet = workbook.add_worksheet(partner_name[:31])
131
+ report_data["sheet"] = new_sheet
132
+ report_data["row_pos"] = 0
133
+
134
+ for account_id in Open_items.keys():
135
+ if partner_id in Open_items[account_id]:
136
+ self.write_array_title(
137
+ accounts_data[account_id]["code"]
138
+ + " - "
139
+ + accounts_data[account_id]["name"],
140
+ report_data,
141
+ )
142
+
143
+ # For each partner
144
+ if Open_items[account_id]:
145
+ type_object = "partner"
146
+ # Write partner title
147
+ self.write_array_title(
148
+ partners_data[partner_id]["name"], report_data
149
+ )
150
+
151
+ # Calculate totals by partner_id
152
+ partner_totals = self._calculate_amounts_by_partner(
153
+ account_id, Open_items[account_id][partner_id]
154
+ )
155
+ # Display array header for move lines
156
+ self.write_array_header(report_data)
157
+ # Display account move lines
158
+ has_lines = False
159
+ for partner_id_key, total_amount_dict in partner_totals.get(
160
+ account_id, {}
161
+ ).items():
162
+ for line in Open_items[account_id][partner_id]:
163
+ if line["partner_id"] == partner_id_key:
164
+ line.update(
165
+ {
166
+ "account": accounts_data[account_id][
167
+ "code"
168
+ ],
169
+ "journal": journals_data[
170
+ line["journal_id"]
171
+ ]["code"],
172
+ }
173
+ )
174
+ self.write_line_from_dict(line, report_data)
175
+ has_lines = True
176
+ if has_lines:
177
+ partner = self.env["res.partner"].browse(partner_id_key)
178
+ # Display ending balance line for partner
179
+ partner_data = {
180
+ "id": partner_id_key,
181
+ "name": partner.name
182
+ if partner
183
+ else _("Missing Partner"),
184
+ "currency_id": accounts_data[account_id][
185
+ "currency_id"
186
+ ],
187
+ "currency_name": accounts_data[account_id][
188
+ "currency_name"
189
+ ],
190
+ "residual": total_amount_dict,
191
+ }
192
+ self.write_ending_balance_from_dict(
193
+ partner_data,
194
+ "partner_subtotal",
195
+ partner_totals,
196
+ report_data,
197
+ account_id=account_id,
198
+ partner_id=partner_id_key,
199
+ )
200
+ has_lines = False
201
+ # Display ending balance line for salesperson
202
+ partners_data[partner_id].update(
203
+ {
204
+ "currency_id": accounts_data[account_id]["currency_id"],
205
+ "currency_name": accounts_data[account_id][
206
+ "currency_name"
207
+ ],
208
+ }
209
+ )
210
+ self.write_ending_balance_from_dict(
211
+ partners_data[partner_id],
212
+ type_object,
213
+ total_amount,
214
+ report_data,
215
+ account_id=account_id,
216
+ partner_id=partner_id,
217
+ )
218
+ # Line break
219
+ report_data["row_pos"] += 1
220
+
221
+ def _generate_report_content_by_partner(
222
+ self, workbook, report, data, report_data, res_data
223
+ ):
109
224
  Open_items = res_data["Open_Items"]
110
225
  accounts_data = res_data["accounts_data"]
111
226
  partners_data = res_data["partners_data"]
@@ -120,7 +235,6 @@ class OpenItemsXslx(models.AbstractModel):
120
235
  + accounts_data[account_id]["name"],
121
236
  report_data,
122
237
  )
123
-
124
238
  # For each partner
125
239
  if Open_items[account_id]:
126
240
  if show_partner_details:
@@ -180,18 +294,33 @@ class OpenItemsXslx(models.AbstractModel):
180
294
  )
181
295
  self.write_line_from_dict(line, report_data)
182
296
 
183
- # Display ending balance line for account
184
- type_object = "account"
185
- self.write_ending_balance_from_dict(
186
- accounts_data[account_id],
187
- type_object,
188
- total_amount,
189
- report_data,
190
- account_id=account_id,
191
- )
297
+ # Display ending balance line for account
298
+ type_object = "account"
299
+ self.write_ending_balance_from_dict(
300
+ accounts_data[account_id],
301
+ type_object,
302
+ total_amount,
303
+ report_data,
304
+ account_id=account_id,
305
+ )
306
+
307
+ # 2 lines break
308
+ report_data["row_pos"] += 2
192
309
 
193
- # 2 lines break
194
- report_data["row_pos"] += 2
310
+ def _generate_report_content(self, workbook, report, data, report_data):
311
+ res_data = self.env[
312
+ "report.account_financial_report.open_items"
313
+ ]._get_report_values(report, data)
314
+ show_partner_details = res_data["show_partner_details"]
315
+ grouped_by = res_data["grouped_by"]
316
+ if grouped_by == "salesperson" and show_partner_details:
317
+ return self._generate_report_content_by_salesperson(
318
+ workbook, report, data, report_data, res_data
319
+ )
320
+ else:
321
+ return self._generate_report_content_by_partner(
322
+ workbook, report, data, report_data, res_data
323
+ )
195
324
 
196
325
  def write_ending_balance_from_dict(
197
326
  self,
@@ -211,6 +340,10 @@ class OpenItemsXslx(models.AbstractModel):
211
340
  name = my_object["code"] + " - " + my_object["name"]
212
341
  my_object["residual"] = total_amount[account_id]["residual"]
213
342
  label = _("Ending balance")
343
+ elif type_object == "partner_subtotal":
344
+ name = my_object["name"]
345
+ my_object["residual"] = total_amount[account_id][partner_id]["residual"]
346
+ label = _("Ending balance")
214
347
  return super().write_ending_balance_from_dict(
215
348
  my_object, name, label, report_data
216
349
  )