odoo-addon-account-financial-report 15.0.1.1.0.1__py3-none-any.whl → 18.0.1.4.4.3__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.
Files changed (104) hide show
  1. odoo/addons/account_financial_report/README.rst +131 -74
  2. odoo/addons/account_financial_report/__manifest__.py +6 -9
  3. odoo/addons/account_financial_report/i18n/account_financial_report.pot +313 -188
  4. odoo/addons/account_financial_report/i18n/ar.po +579 -433
  5. odoo/addons/account_financial_report/i18n/ca.po +474 -289
  6. odoo/addons/account_financial_report/i18n/{fr_FR.po → ca_AD.po} +539 -491
  7. odoo/addons/account_financial_report/i18n/ca_ES.po +1891 -0
  8. odoo/addons/account_financial_report/i18n/de.po +455 -295
  9. odoo/addons/account_financial_report/i18n/es.po +458 -394
  10. odoo/addons/account_financial_report/i18n/es_AR.po +464 -283
  11. odoo/addons/account_financial_report/i18n/es_MX.po +315 -220
  12. odoo/addons/account_financial_report/i18n/fr.po +620 -435
  13. odoo/addons/account_financial_report/i18n/fr_CH.po +616 -462
  14. odoo/addons/account_financial_report/i18n/hr.po +506 -355
  15. odoo/addons/account_financial_report/i18n/hr_HR.po +331 -232
  16. odoo/addons/account_financial_report/i18n/it.po +538 -356
  17. odoo/addons/account_financial_report/i18n/ja.po +339 -240
  18. odoo/addons/account_financial_report/i18n/nl.po +462 -324
  19. odoo/addons/account_financial_report/i18n/nl_NL.po +318 -220
  20. odoo/addons/account_financial_report/i18n/pt.po +429 -242
  21. odoo/addons/account_financial_report/i18n/pt_BR.po +588 -438
  22. odoo/addons/account_financial_report/i18n/ro.po +499 -342
  23. odoo/addons/account_financial_report/i18n/sl.po +1945 -0
  24. odoo/addons/account_financial_report/i18n/sv.po +1997 -0
  25. odoo/addons/account_financial_report/i18n/tr.po +1947 -0
  26. odoo/addons/account_financial_report/menuitems.xml +1 -1
  27. odoo/addons/account_financial_report/models/__init__.py +2 -0
  28. odoo/addons/account_financial_report/models/account_age_report_configuration.py +49 -0
  29. odoo/addons/account_financial_report/models/account_group.py +62 -23
  30. odoo/addons/account_financial_report/models/account_move_line.py +33 -3
  31. odoo/addons/account_financial_report/models/ir_actions_report.py +6 -4
  32. odoo/addons/account_financial_report/models/res_config_settings.py +36 -0
  33. odoo/addons/account_financial_report/readme/CONFIGURE.md +26 -0
  34. odoo/addons/account_financial_report/readme/CONTRIBUTORS.md +38 -0
  35. odoo/addons/account_financial_report/readme/CREDITS.md +1 -0
  36. odoo/addons/account_financial_report/readme/DESCRIPTION.md +21 -0
  37. odoo/addons/account_financial_report/readme/HISTORY.md +16 -0
  38. odoo/addons/account_financial_report/readme/ROADMAP.md +6 -0
  39. odoo/addons/account_financial_report/report/abstract_report.py +73 -23
  40. odoo/addons/account_financial_report/report/abstract_report_xlsx.py +28 -23
  41. odoo/addons/account_financial_report/report/aged_partner_balance.py +131 -30
  42. odoo/addons/account_financial_report/report/aged_partner_balance_xlsx.py +158 -118
  43. odoo/addons/account_financial_report/report/general_ledger.py +421 -340
  44. odoo/addons/account_financial_report/report/general_ledger_xlsx.py +127 -75
  45. odoo/addons/account_financial_report/report/journal_ledger.py +84 -68
  46. odoo/addons/account_financial_report/report/journal_ledger_xlsx.py +14 -8
  47. odoo/addons/account_financial_report/report/open_items.py +113 -70
  48. odoo/addons/account_financial_report/report/open_items_xlsx.py +152 -19
  49. odoo/addons/account_financial_report/report/templates/aged_partner_balance.xml +408 -311
  50. odoo/addons/account_financial_report/report/templates/general_ledger.xml +273 -213
  51. odoo/addons/account_financial_report/report/templates/journal_ledger.xml +70 -76
  52. odoo/addons/account_financial_report/report/templates/layouts.xml +12 -1
  53. odoo/addons/account_financial_report/report/templates/open_items.xml +181 -55
  54. odoo/addons/account_financial_report/report/templates/trial_balance.xml +304 -195
  55. odoo/addons/account_financial_report/report/templates/vat_report.xml +10 -10
  56. odoo/addons/account_financial_report/report/trial_balance.py +463 -211
  57. odoo/addons/account_financial_report/report/trial_balance_xlsx.py +37 -38
  58. odoo/addons/account_financial_report/report/vat_report.py +36 -25
  59. odoo/addons/account_financial_report/report/vat_report_xlsx.py +1 -1
  60. odoo/addons/account_financial_report/security/ir.model.access.csv +2 -0
  61. odoo/addons/account_financial_report/security/security.xml +8 -0
  62. odoo/addons/account_financial_report/static/description/index.html +106 -55
  63. odoo/addons/account_financial_report/static/src/css/report.css +77 -42
  64. odoo/addons/account_financial_report/static/src/css/report_html.css +10 -0
  65. odoo/addons/account_financial_report/static/src/js/report.esm.js +72 -0
  66. odoo/addons/account_financial_report/static/src/js/report_action.esm.js +39 -0
  67. odoo/addons/account_financial_report/static/src/xml/report.xml +10 -9
  68. odoo/addons/account_financial_report/tests/__init__.py +1 -0
  69. odoo/addons/account_financial_report/tests/test_age_report_configuration.py +42 -0
  70. odoo/addons/account_financial_report/tests/test_aged_partner_balance.py +99 -9
  71. odoo/addons/account_financial_report/tests/test_general_ledger.py +19 -9
  72. odoo/addons/account_financial_report/tests/test_journal_ledger.py +18 -9
  73. odoo/addons/account_financial_report/tests/test_open_items.py +42 -2
  74. odoo/addons/account_financial_report/tests/test_trial_balance.py +114 -223
  75. odoo/addons/account_financial_report/tests/test_vat_report.py +17 -9
  76. odoo/addons/account_financial_report/view/account_age_report_configuration_views.xml +41 -0
  77. odoo/addons/account_financial_report/view/res_config_settings_views.xml +51 -0
  78. odoo/addons/account_financial_report/wizard/abstract_wizard.py +23 -0
  79. odoo/addons/account_financial_report/wizard/aged_partner_balance_wizard.py +22 -8
  80. odoo/addons/account_financial_report/wizard/aged_partner_balance_wizard_view.xml +2 -3
  81. odoo/addons/account_financial_report/wizard/general_ledger_wizard.py +42 -36
  82. odoo/addons/account_financial_report/wizard/general_ledger_wizard_view.xml +26 -41
  83. odoo/addons/account_financial_report/wizard/journal_ledger_wizard.py +19 -7
  84. odoo/addons/account_financial_report/wizard/journal_ledger_wizard_view.xml +15 -14
  85. odoo/addons/account_financial_report/wizard/open_items_wizard.py +34 -8
  86. odoo/addons/account_financial_report/wizard/open_items_wizard_view.xml +16 -14
  87. odoo/addons/account_financial_report/wizard/trial_balance_wizard.py +68 -45
  88. odoo/addons/account_financial_report/wizard/trial_balance_wizard_view.xml +40 -39
  89. odoo/addons/account_financial_report/wizard/vat_report_wizard.py +9 -3
  90. odoo/addons/account_financial_report/wizard/vat_report_wizard_view.xml +14 -14
  91. odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info/METADATA +234 -0
  92. odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info/RECORD +107 -0
  93. {odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info → odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info}/WHEEL +1 -1
  94. odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info/top_level.txt +1 -0
  95. odoo/addons/account_financial_report/readme/CONTRIBUTORS.rst +0 -35
  96. odoo/addons/account_financial_report/readme/DESCRIPTION.rst +0 -16
  97. odoo/addons/account_financial_report/readme/HISTORY.rst +0 -19
  98. odoo/addons/account_financial_report/readme/ROADMAP.rst +0 -7
  99. odoo/addons/account_financial_report/static/src/js/action_manager_report.js +0 -37
  100. odoo/addons/account_financial_report/static/src/js/client_action.js +0 -58
  101. odoo/addons/account_financial_report/static/src/js/report.js +0 -58
  102. odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info/METADATA +0 -179
  103. odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info/RECORD +0 -95
  104. odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info/top_level.txt +0 -1
@@ -4,7 +4,7 @@
4
4
  parent="account.menu_finance_reports"
5
5
  id="menu_oca_reports"
6
6
  name="OCA accounting reports"
7
- groups="account.group_account_manager,account.group_account_user"
7
+ groups="account.group_account_user"
8
8
  />
9
9
  <menuitem
10
10
  parent="menu_oca_reports"
@@ -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,49 @@
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(self.env._("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(
40
+ self.env._("Inferior Limit must be greather than zero")
41
+ )
42
+
43
+ _sql_constraints = [
44
+ (
45
+ "unique_name_config_combination",
46
+ "UNIQUE(name,account_age_report_config_id)",
47
+ "Name must be unique per report configuration",
48
+ )
49
+ ]
@@ -2,6 +2,7 @@
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3
3
 
4
4
  from odoo import api, fields, models
5
+ from odoo.tools import SQL
5
6
 
6
7
 
7
8
  class AccountGroup(models.Model):
@@ -12,13 +13,17 @@ class AccountGroup(models.Model):
12
13
  )
13
14
  level = fields.Integer(compute="_compute_level", recursive=True)
14
15
  account_ids = fields.One2many(
15
- comodel_name="account.account", inverse_name="group_id", string="Accounts"
16
+ comodel_name="account.account",
17
+ compute="_compute_account_ids",
18
+ string="Accounts",
19
+ store=False,
16
20
  )
17
21
  compute_account_ids = fields.Many2many(
18
22
  "account.account",
23
+ recursive=True,
19
24
  compute="_compute_group_accounts",
20
25
  string="Compute accounts",
21
- store=True,
26
+ store=False,
22
27
  )
23
28
  complete_name = fields.Char(
24
29
  "Full Name", compute="_compute_complete_name", recursive=True
@@ -30,20 +35,60 @@ class AccountGroup(models.Model):
30
35
  @api.depends("name", "parent_id.complete_name")
31
36
  def _compute_complete_name(self):
32
37
  """Forms complete name of location from parent location to child location."""
33
- if self.parent_id.complete_name:
34
- self.complete_name = "{}/{}".format(self.parent_id.complete_name, self.name)
35
- else:
36
- self.complete_name = self.name
38
+ for group in self:
39
+ if group.parent_id.complete_name:
40
+ group.complete_name = f"{group.parent_id.complete_name}/{group.name}"
41
+ else:
42
+ group.complete_name = group.name
43
+
44
+ @api.depends("code_prefix_start", "code_prefix_end")
45
+ def _compute_account_ids(self):
46
+ """Retrieves every account from `self`.
47
+ In Odoo 18 the group_id on account is not stored so it raises
48
+ an error the one2many account_ids with inverse name group_id."""
49
+ group_ids = self.ids
50
+ self.account_ids = self.env["account.account"]
51
+ if not group_ids:
52
+ return
53
+ group_ids = SQL(",".join(map(str, group_ids)))
54
+ results = self.env.execute_query(
55
+ SQL(
56
+ """
57
+ SELECT
58
+ agroup.id AS group_id,
59
+ STRING_AGG(DISTINCT account.id::text, ', ') as account_ids
60
+ FROM account_group agroup
61
+ inner join account_account account
62
+ ON agroup.code_prefix_start <= LEFT(%(code_store)s->>agroup.company_id::text,
63
+ char_length(agroup.code_prefix_start))
64
+ AND agroup.code_prefix_end >= LEFT(%(code_store)s->>agroup.company_id::text,
65
+ char_length(agroup.code_prefix_end))
66
+ WHERE agroup.id IN (%(group_ids)s)
67
+ GROUP BY agroup.id
68
+ """,
69
+ code_store=SQL.identifier("account", "code_store"),
70
+ group_ids=group_ids,
71
+ )
72
+ )
73
+ group_by_code = dict(results)
74
+ if not group_by_code:
75
+ return
76
+ for record in self:
77
+ if group_by_code.get(record.id, ""):
78
+ record.account_ids = list(
79
+ map(int, group_by_code.get(record.id, "").split(", "))
80
+ )
37
81
 
38
82
  @api.depends("code_prefix_start", "parent_id.complete_code")
39
83
  def _compute_complete_code(self):
40
84
  """Forms complete code of location from parent location to child location."""
41
- if self.parent_id.complete_code:
42
- self.complete_code = "{}/{}".format(
43
- self.parent_id.complete_code, self.code_prefix_start
44
- )
45
- else:
46
- self.complete_code = self.code_prefix_start
85
+ for group in self:
86
+ if group.parent_id.complete_code:
87
+ group.complete_code = (
88
+ f"{group.parent_id.complete_code}/{group.code_prefix_start}"
89
+ )
90
+ else:
91
+ group.complete_code = group.code_prefix_start
47
92
 
48
93
  @api.depends("parent_id", "parent_id.level")
49
94
  def _compute_level(self):
@@ -54,16 +99,10 @@ class AccountGroup(models.Model):
54
99
  group.level = group.parent_id.level + 1
55
100
 
56
101
  @api.depends(
57
- "code_prefix_start",
58
- "account_ids",
59
- "account_ids.code",
60
- "group_child_ids",
61
- "group_child_ids.account_ids.code",
102
+ "group_child_ids.compute_account_ids",
62
103
  )
63
104
  def _compute_group_accounts(self):
64
- account_obj = self.env["account.account"]
65
- accounts = account_obj.search([])
66
- for group in self:
67
- prefix = group.code_prefix_start if group.code_prefix_start else group.name
68
- gr_acc = accounts.filtered(lambda a: a.code.startswith(prefix)).ids
69
- group.compute_account_ids = [(6, 0, gr_acc)]
105
+ for one in self:
106
+ one.compute_account_ids = (
107
+ one.account_ids | one.group_child_ids.compute_account_ids
108
+ )
@@ -1,11 +1,41 @@
1
1
  # Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
3
- from odoo import api, models
3
+ from collections import defaultdict
4
+
5
+ from odoo import api, fields, models
6
+ from odoo.fields import Command
4
7
 
5
8
 
6
9
  class AccountMoveLine(models.Model):
7
10
  _inherit = "account.move.line"
8
11
 
12
+ analytic_account_ids = fields.Many2many(
13
+ "account.analytic.account", compute="_compute_analytic_account_ids", store=True
14
+ )
15
+
16
+ @api.depends("analytic_distribution")
17
+ def _compute_analytic_account_ids(self):
18
+ # Prefetch all involved analytic accounts
19
+ batch_by_analytic_account = defaultdict(lambda: self.env["account.move.line"])
20
+ for record in self.filtered("analytic_distribution"):
21
+ # NB: ``analytic_distribution`` is a JSON field where keys can be either
22
+ # 'account.id' or 'account.id,account.id'
23
+ # Eg: https://github.com/odoo/odoo/blob/8479b4e/addons/sale/models/account_move_line.py#L158
24
+ for key in record.analytic_distribution:
25
+ for account_id in map(int, key.split(",")):
26
+ batch_by_analytic_account[account_id] += record
27
+ existing_account_ids = set(
28
+ self.env["account.analytic.account"]
29
+ .browse(batch_by_analytic_account)
30
+ .exists()
31
+ .ids
32
+ )
33
+ # Store them
34
+ self.analytic_account_ids = [Command.clear()]
35
+ for account_id, records in batch_by_analytic_account.items():
36
+ if account_id in existing_account_ids:
37
+ records.analytic_account_ids = [Command.link(account_id)]
38
+
9
39
  def init(self):
10
40
  """
11
41
  The join between accounts_partners subquery and account_move_line
@@ -32,9 +62,9 @@ class AccountMoveLine(models.Model):
32
62
  )
33
63
 
34
64
  @api.model
35
- def search_count(self, args):
65
+ def search_count(self, domain, limit=None):
36
66
  # In Big DataBase every time you change the domain widget this method
37
67
  # takes a lot of time. This improves performance
38
68
  if self.env.context.get("skip_search_count"):
39
69
  return 0
40
- return super(AccountMoveLine, self).search_count(args)
70
+ return super().search_count(domain, limit=limit)
@@ -13,13 +13,15 @@ class IrActionsReport(models.Model):
13
13
  return dict(self.env.context or {}, lang=lang) if lang else False
14
14
 
15
15
  @api.model
16
- def _render_qweb_html(self, docids, data=None):
16
+ def _render_qweb_html(self, report_ref, docids, data=None):
17
17
  context = self._prepare_account_financial_report_context(data)
18
18
  obj = self.with_context(**context) if context else self
19
- return super(IrActionsReport, obj)._render_qweb_html(docids, data)
19
+ return super(IrActionsReport, obj)._render_qweb_html(
20
+ report_ref, docids, data=data
21
+ )
20
22
 
21
23
  @api.model
22
- def _render_xlsx(self, docids, data):
24
+ def _render_xlsx(self, report_ref, docids, data=None):
23
25
  context = self._prepare_account_financial_report_context(data)
24
26
  obj = self.with_context(**context) if context else self
25
- return super(IrActionsReport, obj)._render_xlsx(docids, data)
27
+ return super(IrActionsReport, obj)._render_xlsx(report_ref, docids, data=data)
@@ -0,0 +1,36 @@
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 api, fields, models
5
+
6
+
7
+ class ResConfigSettings(models.TransientModel):
8
+ _inherit = "res.config.settings"
9
+
10
+ age_partner_config_id = fields.Many2one(
11
+ "account.age.report.configuration",
12
+ string="Intervals configuration",
13
+ )
14
+
15
+ def set_values(self):
16
+ self.env["ir.default"].sudo().set(
17
+ "aged.partner.balance.report.wizard",
18
+ "age_partner_config_id",
19
+ self.age_partner_config_id.id,
20
+ company_id=self.env.company.id,
21
+ )
22
+ return super().set_values()
23
+
24
+ @api.model
25
+ def get_values(self):
26
+ res = super().get_values()
27
+ res.update(
28
+ age_partner_config_id=self.env["ir.default"]
29
+ .sudo()
30
+ ._get(
31
+ "aged.partner.balance.report.wizard",
32
+ "age_partner_config_id",
33
+ company_id=self.env.company.id,
34
+ )
35
+ )
36
+ return res
@@ -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' -> 'Reporting' -> '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'.
@@ -0,0 +1,38 @@
1
+ - Jordi Ballester \<<jordi.ballester@forgeflow.com>\>
2
+ - Yannick Vaucher \<<yannick.vaucher@camptocamp.com>\>
3
+ - Simone Orsi \<<simone.orsi@abstract.com>\>
4
+ - Leonardo Pistone \<<leonardo.pistone@camptocamp.com>\>
5
+ - Damien Crier \<<damien.crier@camptocamp.com>\>
6
+ - Andrea Stirpe \<<a.stirpe@onestein.nl>\>
7
+ - Thomas Rehn \<<thomas.rehn@initos.com>\>
8
+ - Andrea Gallina \<<4everamd@gmail.com>\>
9
+ - Robert Rottermann \<<robert@redcor.ch>\>
10
+ - Ciro Urselli \<<c.urselli@apuliasoftware.it>\>
11
+ - Francesco Apruzzese \<<opencode@e-ware.org>\>
12
+ - Lorenzo Battistini \<<https://github.com/eLBati>\>
13
+ - Julien Coux \<<julien.coux@camptocamp.com>\>
14
+ - Akim Juillerat \<<akim.juillerat@camptocamp.com>\>
15
+ - Alexis de Lattre \<<alexis@via.ecp.fr>\>
16
+ - Mihai Fekete \<<feketemihai@gmail.com>\>
17
+ - Miquel Ra??ch \<<miquel.raich@forgeflow.com>\>
18
+ - Joan Sisquella \<<joan.sisquella@forgeflow.com>\>
19
+ - [Tecnativa](https://www.tecnativa.com):
20
+ - Pedro M. Baeza
21
+ - Sergio Teruel
22
+ - Ernesto Tejeda
23
+ - João Marques
24
+ - Alexandre D. D??az
25
+ - V??ctor Mart??nez
26
+ - Carolina Fernandez
27
+ - [Sygel](https://www.sygel.es):
28
+ - Harald Panten
29
+ - Valentin Vinagre
30
+ - Lois Rilo \<<lois.rilo@forgeflow.com>\>
31
+ - Saran Lim. \<<saranl@ecosoft.co.th>\>
32
+ - Omar Casti??eira \<<omar@comunitea.com>\>
33
+ - Chau Le \<<chaulb@trobz.com>\>
34
+ - [Stesi Consulting](https://www.stesi.consulting):
35
+ - Michele Di Croce \<<dicroce.m@stesi.consulting>\>
36
+
37
+ Much of the work in this module was done at a sprint in Sorrento, Italy
38
+ in April 2016.
@@ -0,0 +1 @@
1
+ The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.
@@ -0,0 +1,21 @@
1
+ This module adds a set of financial reports. They are accessible under
2
+ Invoicing / Reporting / OCA accounting reports.
3
+
4
+ - General ledger
5
+ - Trial Balance
6
+ - Open Items
7
+ - Aged Partner Balance
8
+ - VAT Report
9
+ - Journal Ledger
10
+
11
+ Currently General ledger, Trial Balance and Open Items are fully
12
+ compatible with a foreign currency set up in account in order to display
13
+ balances. Moreover, any foreign currency used in account move lines is
14
+ properly shown.
15
+
16
+ In case that in an account has not been configured a second currency
17
+ foreign currency balances are not available.
18
+
19
+ Invoicing / Settings / Invoicing / OCA Aged Report Configuration you will be able to set
20
+ dynamic intervals that will appear on the Aged Partner Balance.
21
+ For further information, check CONFIGURE.rst
@@ -0,0 +1,16 @@
1
+ ## 11.0.2.5.0 (2019-04-26)
2
+
3
+ - In the Trial Balance you have an option to hide parent hierarchy
4
+ levels
5
+
6
+ ## 11.0.2.4.1 (2019-01-08)
7
+
8
+ - Handle better multicompany behaviour
9
+ - Improve how title appears in the reports
10
+ - Improve performance in General Ledger
11
+
12
+ ## 11.0.2.3.1 (2018-11-29)
13
+
14
+ - In the Trial Balance you can apply a filter by hierarchy levels
15
+ - In the General Ledger you can apply a filter by Analytic Tag
16
+ - In the Journal Ledger the field 'Journal' is now optional
@@ -0,0 +1,6 @@
1
+ - 'VAT Report' is valid only for cases where it's met that for each Tax
2
+ defined: all the "Account tags" of all the 'Repartition for Invoices'
3
+ or 'Repartition for Credit Notes' are different.
4
+ - It would be nice to have in reports a column indicating the state of
5
+ the entries when the option "All Entries" is selected in "Target
6
+ Moves" field in a wizard
@@ -7,6 +7,16 @@ from odoo import api, models
7
7
  class AgedPartnerBalanceReport(models.AbstractModel):
8
8
  _name = "report.account_financial_report.abstract_report"
9
9
  _description = "Abstract Report"
10
+ COMMON_ML_FIELDS = [
11
+ "account_id",
12
+ "partner_id",
13
+ "journal_id",
14
+ "date",
15
+ "ref",
16
+ "id",
17
+ "move_id",
18
+ "name",
19
+ ]
10
20
 
11
21
  @api.model
12
22
  def _get_move_lines_domain_not_reconciled(
@@ -56,6 +66,8 @@ class AgedPartnerBalanceReport(models.AbstractModel):
56
66
  company_id,
57
67
  partner_ids,
58
68
  only_posted_moves,
69
+ debit_amount_currency,
70
+ credit_amount_currency,
59
71
  ):
60
72
  debit_ids = set(debit_ids)
61
73
  credit_ids = set(credit_ids)
@@ -68,24 +80,8 @@ class AgedPartnerBalanceReport(models.AbstractModel):
68
80
  new_domain = self._get_new_move_lines_domain(
69
81
  new_ml_ids, account_ids, company_id, partner_ids, only_posted_moves
70
82
  )
71
- ml_fields = [
72
- "id",
73
- "name",
74
- "date",
75
- "move_id",
76
- "journal_id",
77
- "account_id",
78
- "partner_id",
79
- "amount_residual",
80
- "date_maturity",
81
- "ref",
82
- "debit",
83
- "credit",
84
- "reconciled",
85
- "currency_id",
86
- "amount_currency",
87
- "amount_residual_currency",
88
- ]
83
+ company_currency = self.env["res.company"].browse(company_id).currency_id
84
+ ml_fields = self._get_ml_fields()
89
85
  new_move_lines = self.env["account.move.line"].search_read(
90
86
  domain=new_domain, fields=ml_fields
91
87
  )
@@ -93,13 +89,45 @@ class AgedPartnerBalanceReport(models.AbstractModel):
93
89
  for move_line in move_lines:
94
90
  ml_id = move_line["id"]
95
91
  if ml_id in debit_ids:
96
- move_line["amount_residual"] += debit_amount[ml_id]
92
+ if move_line.get("amount_residual", False):
93
+ move_line["amount_residual"] += debit_amount[ml_id]
94
+ else:
95
+ move_line["amount_residual"] = debit_amount[ml_id]
96
+ if move_line.get("amount_residual_currency", False):
97
+ move_line["amount_residual_currency"] += debit_amount_currency[
98
+ ml_id
99
+ ]
100
+ else:
101
+ move_line["amount_residual_currency"] = debit_amount_currency[ml_id]
97
102
  if ml_id in credit_ids:
98
- move_line["amount_residual"] -= credit_amount[ml_id]
103
+ if move_line.get("amount_residual", False):
104
+ move_line["amount_residual"] -= credit_amount[ml_id]
105
+ else:
106
+ move_line["amount_residual"] = -credit_amount[ml_id]
107
+ if move_line.get("amount_residual_currency", False):
108
+ move_line["amount_residual_currency"] -= credit_amount_currency[
109
+ ml_id
110
+ ]
111
+ else:
112
+ move_line["amount_residual_currency"] = -credit_amount_currency[
113
+ ml_id
114
+ ]
115
+ # Set amount_currency=0 to keep the same behaviour as in v13
116
+ # Conditions: if there is no curency_id defined or it is equal
117
+ # to the company's curency_id
118
+ if "amount_currency" in move_line and (
119
+ "currency_id" not in move_line
120
+ or move_line["currency_id"] == company_currency.id
121
+ ):
122
+ move_line["amount_currency"] = 0
99
123
  return move_lines
100
124
 
101
125
  def _get_accounts_data(self, accounts_ids):
102
- accounts = self.env["account.account"].browse(accounts_ids)
126
+ accounts = (
127
+ self.env["account.account"]
128
+ .with_context(active_test=False)
129
+ .browse(accounts_ids)
130
+ )
103
131
  accounts_data = {}
104
132
  for account in accounts:
105
133
  accounts_data.update(
@@ -110,7 +138,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
110
138
  "name": account.name,
111
139
  "hide_account": False,
112
140
  "group_id": account.group_id.id,
113
- "currency_id": account.currency_id or False,
141
+ "currency_id": account.currency_id.id,
114
142
  "currency_name": account.currency_id.name,
115
143
  "centralized": account.centralized,
116
144
  }
@@ -119,8 +147,30 @@ class AgedPartnerBalanceReport(models.AbstractModel):
119
147
  return accounts_data
120
148
 
121
149
  def _get_journals_data(self, journals_ids):
122
- journals = self.env["account.journal"].browse(journals_ids)
150
+ journals = (
151
+ self.env["account.journal"]
152
+ .with_context(active_test=False)
153
+ .search_fetch([("id", "in", journals_ids)], ["code"])
154
+ )
123
155
  journals_data = {}
124
156
  for journal in journals:
125
157
  journals_data.update({journal.id: {"id": journal.id, "code": journal.code}})
126
158
  return journals_data
159
+
160
+ def _get_ml_fields(self):
161
+ return self.COMMON_ML_FIELDS + [
162
+ "amount_residual",
163
+ "reconciled",
164
+ "currency_id",
165
+ "credit",
166
+ "date_maturity",
167
+ "amount_residual_currency",
168
+ "debit",
169
+ "amount_currency",
170
+ ]
171
+
172
+ def _get_report_values(self, docids, data):
173
+ wizard = self.env[data["wizard_name"]].browse(data["wizard_id"])
174
+ return {
175
+ "limit_text": wizard._limit_text,
176
+ }