-
-
Notifications
You must be signed in to change notification settings - Fork 785
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
[16.0][ADD] project_task_pull_request_state #1189
[16.0][ADD] project_task_pull_request_state #1189
Conversation
21886e2
to
93c8ef7
Compare
] | ||
|
||
@api.model | ||
def create(self, vals): |
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.
Use multi record "create" implementation with vals_list instead of vale and api.create multi decorator
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.
resolved
pr_state = ICPSudo.get_param( | ||
"project_task_pull_request_state.pr_state_default" | ||
) | ||
task.pr_state = pr_state |
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.
What if no config value is defined or it is empty?
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.
resolved
12772fe
to
1192515
Compare
9fe5e9e
to
f754cee
Compare
f754cee
to
0bf3814
Compare
pandoc-3.1.9-1-amd64.deb
Outdated
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.
What is is file doing here?) Is it needed? Please remove if not
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.
resolved
@@ -0,0 +1 @@ | |||
- Cetmix <https://cetmix.com/> |
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.
Please use MD format for links
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.
resolved
class TestPullRequestState(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(TestPullRequestState, cls).setUpClass() |
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.
Disable tracking unless you need it for functional purposes
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
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.
resolved
|
||
pr_state = fields.Selection( | ||
selection=lambda self: self._selection_pr_state(), | ||
track_visibility="onchange", |
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 format of the "track_visibility" is not used any longer. Actually the is a warning in tests for that.
Here is a reference for that.
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.
resolved
"PR URI is added to a task in this project", | ||
) | ||
|
||
def set_values(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 function is not needed. Please use config_parameter in the field definition instead
pr_state_default = fields.Selection(
selection=lambda self: self.env["project.task"]._selection_pr_state(),
string="Default PR State",
config_parameter="project_task_pull_request_state.pr_state_default"
help="Default PR state that will be set when "
"PR URI is added to a task in this project",
)
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.
applied
@@ -0,0 +1 @@ | |||
- Cetmix <@cetmix.com> |
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.
Please check back to
Cetmix <https://cetmix.com/>
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.
applied
new_recs = super(ProjectTaskState, self).create(vals_list) | ||
|
||
# Set pr state if URI is provided at creation | ||
for new_rec, vals in zip(new_recs, vals_list): |
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.
pr_state will be computed automatically upon creation. No need to call this function explicitly
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.
resolved
@@ -17,14 +17,6 @@ class ProjectTaskState(models.Model): | |||
readonly=False, | |||
) | |||
|
|||
_sql_constraints = [ |
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'm not sure if this is necessary. But I also don't understand why it doesn't work, maybe you have some idea. Now it's occured this error
5947b82
to
af27f0b
Compare
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.
Functionality OK
@@ -0,0 +1 @@ | |||
* Cetmix <https://cetmix.com/> |
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.
Please complete this section according to the latest updates in the DevMemo
Cetmix <https://cetmix.com/>
Ivan Sokolov
Vladimir Kalmykov
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.
Applied
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'd suggest going with
* `Cetmix <https://cetmix.com/>`__
* Ivan Sokolov
* Vladimir Kalmykov
Formatting, note the extra newline
801719b
to
120a008
Compare
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.
Code review LGTM
120a008
to
3616588
Compare
hey @OCA/project-service-maintainers happy 2024! What a great opportunity to have one more PR merged while we are still in 2023 😄 |
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.
Thanks for the PR! The comments are non-blocking
@@ -0,0 +1,3 @@ | |||
# Copyright Cetmix OU 2023 |
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.
init.py don't typically include copyright notice since there's nothing to apply copyright to.
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.
fixed
from odoo import fields, models | ||
|
||
|
||
class ProjectState(models.Model): |
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.
Model name follows the filename commonly, and since this model is a well-known one there's no point in having different name.
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.
fixed
readonly=False, | ||
) | ||
|
||
def _selection_pr_state(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.
Do you anticipate that this could be plausibly extended in some cases? Please elaborate
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.
fixed
@@ -0,0 +1 @@ | |||
* Cetmix <https://cetmix.com/> |
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'd suggest going with
* `Cetmix <https://cetmix.com/>`__
* Ivan Sokolov
* Vladimir Kalmykov
Formatting, note the extra newline
# Change pr_state | ||
tasks.write({"pr_state": "closed"}) | ||
|
||
self.assertEqual(self.task_1.pr_state, "closed", "PR state must be 'closed") |
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 guess there's closing '
missing? If that message is even worth having
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.
applied
from odoo import api, fields, models | ||
|
||
|
||
class ProjectTaskState(models.Model): |
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.
class ProjectTaskState(models.Model): | |
class ProjectTask(models.Model): |
It would be better to follow the common naming as in https://github.com/OCA/project/pull/1189/files#r1440500916
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.
@leemannd, thank you for suggestion. I added this to the last commit.
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
@leemannd The merge process could not be finalized, because command
|
Hi @leemannd could you please check what could be a reason of the merge issue? |
a0d4a09
to
03f3149
Compare
Hi @leemannd I have rebase the branch, could you please try merging it again? |
This PR looks fantastic, let's merge it! |
@leemannd The merge process could not be finalized, because command
|
That's a problem in the readme. |
Thank you @sbidoul ! Any hint on how this should be solved? |
Look for a list that does not end with a blank line. |
2a44d74
to
69e67df
Compare
Ok @leemannd let's give it another try 😆 |
/ocabot merge nobump |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at 874e53a. Thanks a lot for contributing to OCA. ❤️ |
It adds a "State" field to Task alongside with PR URI field.