Skip to content

Commit

Permalink
[IMP] mis_builder: Filter period by company
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella committed Oct 30, 2023
1 parent 6318075 commit 1b865a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def _compute_dates(self):
default="[]",
help="A domain to additionally filter move lines considered in this column.",
)
filter_company_ids = fields.Many2many("res.company")

_order = "sequence, id"

Expand Down Expand Up @@ -424,6 +425,8 @@ def _get_filter_domain_from_context(self):
# report-level analytic domain filter
if self.analytic_domain:
filters.extend(ast.literal_eval(self.analytic_domain))
if self.filter_company_ids:
filters.extend([("company_id", "in", self.filter_company_ids.ids)])
# contextual analytic domain filter
filters.extend(self.env.context.get("mis_analytic_domain", []))
return filters
Expand Down Expand Up @@ -461,6 +464,8 @@ def _get_additional_move_line_filter(self):
)
for tag in self.analytic_tag_ids:
domain.append(("analytic_tag_ids", "=", tag.id))
if self.filter_company_ids:
domain.extend([("company_id", "in", self.filter_company_ids.ids)])
if self.analytic_domain:
# Extend the domain with the column-level analytic domain
domain.extend(ast.literal_eval(self.analytic_domain))
Expand Down
1 change: 1 addition & 0 deletions mis_builder/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Arnaud Pineux <arnaud.pineux@acsone.eu>
* Ernesto Tejeda <ernesto.tejeda@tecnativa.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Enric Tobella <enric.tobella@dixmit.com>
* `CorporateHub <https://corporatehub.eu/>`__

* Alexey Pelykh <alexey.pelykh@corphub.eu>
1 change: 1 addition & 0 deletions mis_builder/views/mis_report_instance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
<field name="analytic_account_id" />
<field name="analytic_group_id" />
<field name="analytic_tag_ids" widget="many2many_tags" />
<field name="filter_company_ids" widget="many2many_tags" />
</group>
</form>
</field>
Expand Down

0 comments on commit 1b865a0

Please sign in to comment.