-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
base: 17.0
Are you sure you want to change the base?
Conversation
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/
afc6281
to
a8bef8e
Compare
/ocabot rebase |
Congratulations, PR rebased to 17.0. |
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.
Functionnal review OK
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 have several doubts on the code...
@@ -31,26 +20,13 @@ class AutomationConfiguration(models.Model): | |||
domain = fields.Char( | |||
required=True, | |||
default="[]", | |||
help="Filter to apply", |
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 did you simplify the help?
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.
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) |
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 did you remove the context?
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.
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 " |
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.
You removed all the logic, why?
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.
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
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.
But he has removed all the logic of the query then. We need to find something to apply it.
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.
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 " |
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.
Same here
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.
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, |
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.
The idea of using value is reusing the widget in other fields if necessary. Why did you apply this change?
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.
The implementation in this case is correct, the information is brought from this.props.record.data.graph_data
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 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")); |
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.
loadJS was replaced by loadBundle, loadJS was well implemented. Why was it changed?
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