-
-
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?
Conversation
Hi @sbidoul, |
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.
Functionally it's correct
This PR has the |
906fd56
to
359d267
Compare
359d267
to
4d3dca5
Compare
This PR has the |
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.
Looks good. A couple of questions.
if (company_field := query.sudo().company_field_id) and ( | ||
instance_companies := self.report_instance_id.query_company_ids | ||
): | ||
domain = AND([domain, [(company_field.name, "in", instance_companies.ids)]]) |
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.
Why doing an AND with empty domain?
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think query_company_ids
cannot be empty. And if it was, it would be surprising if the company field on the query was ignored. So may be we could simply assert self.report_instance_id.query_company_ids
if company_field_id
is set.
company_field_id = fields.Many2one( | ||
comodel_name="ir.model.fields", | ||
ondelete="set null", | ||
domain="[('model_id', '=', model_id)]", |
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.
Description
Adds the possibility to specify a company field on queries.
This field will be used to filter records that are on the company of the instance report (using 'query_company_ids')