Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] mis_builder: Filter period by company #575

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
* Ernesto Tejeda <[email protected]>
* Pedro M. Baeza <[email protected]>
* Enric Tobella <[email protected]>
* `CorporateHub <https://corporatehub.eu/>`__

* Alexey Pelykh <[email protected]>
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
Loading