- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 805
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 #1084
Conversation
baa5a78
to
1329761
Compare
1329761
to
01f2b27
Compare
/ocabot migration project_task_code |
The migration issue (#988) has been updated to reference the current pull request. |
01f2b27
to
90103ce
Compare
Hello @Abranes Please this module in 15 (at least) is creating constraint that breaks runboat with other modules. could you FIX it here in migration?
Thank you! |
90103ce
to
f1a8517
Compare
Done! You can review 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.
Code is being set even if in the settings, the Task Code Unique is not checked.
Also check the pre_init_hook
and post_init_hook
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
for vals in 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.
Should be done if user has activated the corresponding parameter in res.config.settings
and sequence exists in self.env.company
.
Is there something pending here still? |
Check @jort-aardug and @Shide suggestions |
@Abranes can you check the suggestions for this to be merged? Thanks |
Sorry guys, I forgot this PR. I'll try to address all points next week. |
@jort-aardug @Shide @robinkeunen @yaazkal could you check it one more time? :) |
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.
praise: Good job with this man :)
Code LGTM
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.
I think there is a confusion here, the module should
- add the task code upon installation
- force the unicity constraint on configuration
The last fixes does the opposite:
- force the unicity constraint upon installation
- create the task code on configuration
It's what @Shide requests and I think it's not a bad approach. |
Hi @rousseldenis @dreispt , we're disagreeing on the way to go with this PR. Can you help us move forward ? |
Maybe we should add a migration script? The module without this fix/feature will break tests for sure at any point in the future... If someone has the bad luck of having this module installed in another way. |
Hello, I don't know in this point which is the disagree. I pinged @Abranes because this module is breaking other modules test, etc... and we said to FIX it here.
We are not using this module at all, just we are affected in other modules un runboat and test because this one. @robinkeunen > But that changes the purpose of the module
Maybe @oihane or @pedrobaeza as original contributors what to put an opinion. I don't know exacly what's the problem now. @dreispt Do you have a solution here o some past use case? Thank you all! 😄 ❤️ |
Can you summarize instead of copying a lot of texts? If I understand correctly, there was a constraint and it has been removed in the migration? Or the contrary? Which is the problem in runboat? |
In 15.0 :
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 from @Abranes, based on @Shide's request, does the opposite, it
|
Thanks for the summary, Robin. It's true that enforcing a uniqueness can be conflicting for prior version databases not containing this constraint migrating to this version. If implemented via SQL constraint, Postgres will try to put the constraint and fail, not having the constraint at all, but only a warning each time you update. Doing that by Python constraint allows to be enabled by configuration, and this would be a saner feature. Another conflicting change is to fill existing taxes with a code, as you may not want to have one at all. I would go for having a button on configuration to fill the code on "empty code" taxes on demand. Do you see it very complicated to be done? |
i don’t understand why so many changes are introduced in a simple version migration. this sql constraint is present since version 8. the hooks that run upon module initialization ensure that this constraint is satisfied, and that tasks created subsequently (even by other modules) will have a unique code (coming from a sequence). it shouldn’t cause an issue. i don’t think it’s a good idea to introduce such significant changes as part of a version migration, unless something that changed in that version prevents the module from working as it did in the previous version. i think that the changes in commit 90103ce are enough. |
Rather than arguing, I propose this PR #1209. I leave it to the PSC to choose what is more appropriate :-) |
could someone give a more detailed explanation about what the problem that we’re trying to solve exactly is (apart from porting this module to 16)? i’ve read that it caused errors during the runboat build. could someone copy the exact error here to see if it can be solved in a simpler way? note that the original sql constraint is not multi-company compatible (it requires uniqueness of the code while it should probably be unique per company) while sequences are per company by default. maybe this could be the issue? |
Hi @rafaelbn
could you mention the error generated ? I don't understand how it can break things ! Thanks ! |
Hi all! I can make the changes you want but first let's all be clear, because in the first instance I perform a normal migration, then modify the module so that the constraint was not by SQL and was by python and thus be able to activate or deactivate it in the configuration to avoid problems with other modules, and finally carry out the current implementation, all at the request of different people. How do you prefer it to proceed? |
i personally think that the sql constraint should stay. it is the only way to ensure uniqueness in a reliable way. checking it in python won’t prevent the same code to be used if records are created at the same time. we need to check what problem the sql constraint actually caused, and fix it without removing the constraint. |
Thinking in an OCA Repo with more modules involved: IMO modules that add constraints on standard models should enable them by configuration, otherwise we reach dead ends. So not by SQL but by python and thus be able to activate or deactivate it in the configuration to avoid problems with other modules Not blocking anything, just my opinion. Thanks all by efforts in the best way! 😄 ❤️ |
Hi. my opinion is "Keep It simple". An SQL constraint is way more simple as constraint enabled by configuration. So, if there is no existing problem, I propose to keep the V15 code. https://github.com/OCA/project/blob/15.0/project_task_code/models/project_task.py#L18-L20 is simpler (2 lines) than :
@rafaelbn : you was saying that V15 runboat was broken, but I see it green. Is it fixed ? https://runboat.odoo-community.org/webui/builds.html?repo=OCA/project&target_branch=15.0 |
Hello @legalsylvain! Happy new year 2024! 😄 @Shide will explain after holidays the problem that this modules causes when living in the same repo with other ones. We are not using this module at all, we just found problems when working in others in the same repo. Thank you! |
@legalsylvain the case which i'm saying this needs a change is because this happens to me in this PR: #1096 (comment) Check out the next 4 comments where i'd invoked you because the runboat breaks |
Hi @Shide. Thanks a lot for pointing the issue. @robinkeunen, could you take a look at this issue ? |
This PR is continued in #1209 |
Supersedes #1013