-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
[IMP] cooperator: Refactor cooperative.membership preparation code #101
[IMP] cooperator: Refactor cooperative.membership preparation code #101
Conversation
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.
great refactoring! thanks @carmenbianca! as this is critical code, it’s important to cover all the cases with tests and run them first without the changes, to ensure that the current (valid) behaviors still work as expected.
efd4a26
to
e820f17
Compare
@@ -154,9 +89,6 @@ def set_cooperator_effective(self, effective_date): | |||
|
|||
self._send_certificate_mail(certificate_email_template, sub_reg_line) |
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 a bit confused by this. Does this assume that the for-loop has one item?
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.
wow, impressive changes! thanks a lot for these, carmen! lgtm, just one comment, up to you to decide.
sorry for the late review.
There were two places where there was broadly the same workflow; set expected values on a partner's cooperative.membership after giving them a membership. That code is now in one place, and does the following as per the docstring: - ``member`` is set to True and ``old_member`` is set to False. - A cooperator register number is assigned if one did not yet exist. - A user is created if one did not yet exist. I also wrote a convenience method get_create_cooperative_membership in res.partner. Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
…dress Using the old method, it was possible (but unlikely) that a different partner's user was affected by changes on the partner. So instead of matching on the login address, match on the partner_id field. As a result of this, the code had to be adjusted to handle multiple user records. Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
e820f17
to
acd1472
Compare
/ocabot merge patch |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at 36cbd02. Thanks a lot for contributing to OCA. ❤️ |
There were two places where there was broadly the same workflow; set expected values on a partner's cooperative.membership after giving them a membership.
That code is now in one place, and does the following as per the docstring:
member
is set to True andold_member
is set to False.This desperately needs tests.
I also wrote an optional convenience functionality into res.partner's get_cooperative_membership: create one if it doesn't yet exist.
Internal task: https://gestion.coopiteasy.be/web#view_type=form&model=project.task&id=9652&active_id=9652&menu_id=