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

[17.0][MIG] automation_oca: Migration to 17.0 #10

Open
wants to merge 19 commits into
base: 17.0
Choose a base branch
from

Conversation

dedinside1337
Copy link

@dedinside1337 dedinside1337 commented Sep 25, 2024

This is my first migration.
Modified:
-added _request_handler method to test_automation_mail.py
-modified automation_step and automation_graph widgets
-rename get_mail_values to _prepare_mail_values in mail_compose_message.py
-rename _send_prepare_body to _prepare_outgoing_body in mail_mail.py
-changed return value of _search method in automation_record.py

etobella and others added 19 commits September 25, 2024 11:22
Currently translated at 100.0% (218 of 218 strings)

Translation: automation-16.0/automation-16.0-automation_oca
Translate-URL: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca/it/
Currently translated at 100.0% (218 of 218 strings)

Translation: automation-16.0/automation-16.0-automation_oca
Translate-URL: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca/it/
Currently translated at 96.7% (211 of 218 strings)

Translation: automation-16.0/automation-16.0-automation_oca
Translate-URL: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca/es/
Currently translated at 61.9% (135 of 218 strings)

Translation: automation-16.0/automation-16.0-automation_oca
Translate-URL: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca/fr/
This commit adds the corresponding imports and preparation
code for using some variables and expressions like `today()`,
`datetime`, `user`, etc in the domain (filter) of the automation
configuration.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: automation-16.0/automation-16.0-automation_oca
Translate-URL: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca/
Currently translated at 100.0% (220 of 220 strings)

Translation: automation-16.0/automation-16.0-automation_oca
Translate-URL: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca/it/
@dedinside1337 dedinside1337 force-pushed the 17.0-mig-automation_oca branch from afc6281 to a8bef8e Compare September 25, 2024 12:18
@Christian-RB Christian-RB mentioned this pull request Nov 27, 2024
@etobella
Copy link
Member

etobella commented Dec 5, 2024

/ocabot rebase

@OCA-git-bot
Copy link
Contributor

Congratulations, PR rebased to 17.0.

Copy link

@percevaq percevaq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionnal review OK

Copy link
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have several doubts on the code...

@@ -31,26 +20,13 @@ class AutomationConfiguration(models.Model):
domain = fields.Char(
required=True,
default="[]",
help="Filter to apply",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you simplify the help?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help should not have been modified

Also, we need to check by autencity field if defined.

In order to do this, we will add some extra joins on the query of the domain
"""
eval_context = self._get_eval_context()
domain = safe_eval(self.domain, eval_context)
domain = safe_eval(self.domain)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the context?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, the function that returns the domain in eval_context was removed and it is not correct. The function _get_eval_context should be there and the code should remain as it was:

eval_context = self._get_eval_context()
domain = safe_eval(self.domain, eval_context)

"id",
"automation_record",
"res_id",
"automation_record",
"{rhs}.model = %s AND {rhs}.configuration_id = %s AND "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed all the logic, why?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both cases, keeping the previous code since they have changed the number of fields returned would give an error:
alias = query.left_join(
TypeError: Query.left_join() takes 6 positional arguments but 8 were given
From what I see, the implementation in the migration is correct

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But he has removed all the logic of the query then. We need to find something to apply it.

Copy link

@mjavint mjavint Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i see

@@ -267,9 +228,6 @@ def _get_automation_records_to_create(self):
"automation_record",
"res_id",
"automation_record_linked",
"{rhs}.model = %s AND {rhs}.configuration_id = %s AND "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both cases, keeping the previous code since they have changed the number of fields returned would give an error:
alias = query.left_join(
TypeError: Query.left_join() takes 6 positional arguments but 8 were given
From what I see, the implementation in the migration is correct

return pt.x;
}),
datasets: [
{
backgroundColor: "#4CAF5080",
borderColor: "#4CAF50",
data: this.props.value.done,
data: this.props.record.data.graph_data.done,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of using value is reusing the widget in other fields if necessary. Why did you apply this change?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation in this case is correct, the information is brought from this.props.record.data.graph_data

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you did not understant me. I know it is implemented in this field, however, if we do this, the widget will only work if we have this specific field name in the model and the field is added in the view. With my suggestion, you will not have this issue.

setup() {
this.chart = null;
this.canvasRef = useRef("canvas");
onWillStart(async () => await loadBundle("web.chartjs_lib"));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadJS was replaced by loadBundle, loadJS was well implemented. Why was it changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants