-
-
Notifications
You must be signed in to change notification settings - Fork 413
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][IMP] crm_project_create: Archive or reactive the project and its analytical account from lead. #631
[16.0][IMP] crm_project_create: Archive or reactive the project and its analytical account from lead. #631
Conversation
Hi @rafaelbn, @EmilioPascual, |
Also you should review the tests. |
2aaebb9
to
5fac8bc
Compare
5fac8bc
to
53c6f90
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.
A little change
self.assertTrue(self.lead.project_id.active) | ||
self.assertTrue(self.lead.project_id.analytic_account_id.active) |
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.
self.assertTrue(self.lead.project_id.active) | |
self.assertTrue(self.lead.project_id.analytic_account_id.active) |
Why do you check the project and the analytic account are active? I think it's not necessary, the project and the account analytic have just been created, they should be active unless you have added a new behavior for it, but this isn't the case.
53c6f90
to
264414d
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 and functional review.
Good Job @edlopen!!
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.
nitpick: Avoid negate variables when not needed
for lead in self.filtered(lambda l: l.project_id): | ||
lead.sudo().project_id.active = not lead.active | ||
lead.sudo().project_id.analytic_account_id.active = not lead.active | ||
return super().toggle_active() |
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 not move super().toggle_active()
to top and avoid the confusing not lead.active
?
for lead in self.filtered(lambda l: l.project_id): | |
lead.sudo().project_id.active = not lead.active | |
lead.sudo().project_id.analytic_account_id.active = not lead.active | |
return super().toggle_active() | |
res = super().toggle_active() | |
for lead in self.filtered(lambda l: l.project_id): | |
lead.sudo().project_id.active = lead.active | |
lead.sudo().project_id.analytic_account_id.active = lead.active | |
return res |
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.
It makes sense. Thanks for the advice!
…ts analytical account from lead. @moduon MT-8265
264414d
to
241b724
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.
👍🏼 tested functionally in runbot
This PR has the |
/ocabot merge minor |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 5d711a8. Thanks a lot for contributing to OCA. ❤️ |
Hello,
This pull request adds the functionality that when archiving or unarchiving an opportunity, its associated projects and analytical accounts are also archived or unarchived. It also works when a lead is lost.
TODO: video
@moduon MT-8265