-
-
Notifications
You must be signed in to change notification settings - Fork 801
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][MIG] project_task_code : alternative without functionality change #1209
[16.0][MIG] project_task_code : alternative without functionality change #1209
Conversation
87b6fbc
to
c04a2de
Compare
/ocabot migration project_task_code |
string="Task Number", | ||
required=True, | ||
default="/", | ||
readonly=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.
Not for migration: What is the reason behind keeping this field readonly?
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.
Because it is generated through a sequence :-)
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.
Functional review LGTM. Using this module in prod already)
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 ok with this, but If in the future happens something that breaks runboat, will be good to modify the module.
The runboat break happens to me in this PR: #1096 (comment)
I'm sorry this is going back and forth that way, not trying to be a troll ... :/ I actually was convinced by @huguesdk and @legalsylvain 's comment on #1084 . I see no reason why the sql constraint would conflict w/ other module since the field code is added by this module. I wonder if the error you had in v15 was due to the constraint checking unicity on the code but not on the company ? We'll see and fix if it rises again. |
Last 3 commits should be smashed. |
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.
@robinkeunen thanks for this. would you please squash the last 3 commits?
Currently translated at 50.0% (3 of 6 strings) Translation: project-14.0/project-14.0-project_task_code Translate-URL: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_task_code/fr_FR/
Currently translated at 100.0% (3 of 3 strings) Translation: project-14.0/project-14.0-project_task_code Translate-URL: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_task_code/es_MX/
Currently translated at 100.0% (3 of 3 strings) Translation: project-14.0/project-14.0-project_task_code Translate-URL: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_task_code/sv/
Currently translated at 100.0% (3 of 3 strings) Translation: project-15.0/project-15.0-project_task_code Translate-URL: https://translation.odoo-community.org/projects/project-15-0/project-15-0-project_task_code/ca/
The overload of project.task::create in the project_task_code would mutate the dictionaries passed in the vals_list argument. This is a bad practice which can have unintended side effects in caller code. We fix this by creating a new dictionary containing the additional field value and passing this dictionary in the call to super().create()
…olates not-null constraint
Currently, the sequence that generates task codes is only available for the main company [1], which could cause issues at the moment of the installation process with another modules in multi-companies cases, for example project_timesheet_holiday [2] because in the other companies, this line [3] will return False or "/" and will trigger the UNIQUE constraint. With this change, the sequence can be used by any company [4] using the False value in the field company_id. References: [1] https://github.com/odoo/odoo/blob/7b6c25e/odoo/addons/base/models/ir_sequence.py#L148 [2] https://github.com/odoo/odoo/blob/7b6c25e/addons/project_timesheet_holidays/models/res_company.py#L14 [3] https://github.com/OCA/project/blob/9d08f2d/project_task_code/models/project_task.py#L29 [4] https://github.com/odoo/odoo/blob/7b6c25e/odoo/addons/base/models/ir_sequence.py#L282
30e58be
to
2ca302e
Compare
/ocabot migration project_task_code |
@legalsylvain , are you PSC here to merge? |
Nop ! |
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.
/ocabot merge patch
Merging as long discussed in other PR, but if any issue I will ping you 😄
On my way to merge this fine PR! |
Congratulations, your PR was merged at 9bbf8b5. Thanks a lot for contributing to OCA. ❤️ |
This PR is an alternative to #1084.
In 15.0 : project_task_code
In his migration review (2023-03-27), @rafaelbn pointed out that the a configuration should be added for the constraint. Otherwise, it breaks the tests from other modules.
I understand from the suggestion that the module should
The fix in #1084 does the opposite, it
It has the advantage of making the module multi-company compliant but at the coast of - according to me - changing the functionality of the module.
I leave it to the PSC to choose the most appropriate PR :-)