-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
[IMP][16.0] mis_builder: use company of report.instance when querying #625
base: 16.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
from odoo import _, api, fields, models | ||
from odoo.exceptions import UserError, ValidationError | ||
from odoo.osv.expression import AND | ||
|
||
from .aep import AccountingExpressionProcessor as AEP | ||
from .expression_evaluator import ExpressionEvaluator | ||
|
@@ -406,7 +407,12 @@ def _get_additional_query_filter(self, query): | |
Returns an Odoo domain expression (a python list) | ||
compatible with the model of the query.""" | ||
self.ensure_one() | ||
return [] | ||
domain = [] | ||
if (company_field := query.sudo().company_field_id) and ( | ||
instance_companies := self.report_instance_id.query_company_ids | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
): | ||
domain = AND([domain, [(company_field.name, "in", instance_companies.ids)]]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why doing an AND with empty domain? |
||
return domain | ||
|
||
@api.constrains("mode", "source") | ||
def _check_mode_source(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This domain seems correct, but I wonder why it is not on the
date_field
above.