From 23f81942fe270952ed84da58348be0be32498dbb Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Thu, 26 Mar 2020 18:05:04 +0100 Subject: [PATCH 1/2] [FIX] emc: check share to_company and to_individual on transfer --- easy_my_coop/models/operation_request.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/easy_my_coop/models/operation_request.py b/easy_my_coop/models/operation_request.py index 1a00377..3d493c3 100644 --- a/easy_my_coop/models/operation_request.py +++ b/easy_my_coop/models/operation_request.py @@ -200,6 +200,14 @@ class operation_request(models.Model): raise ValidationError(_("This share type could not be" " transfered to " + self.partner_id_to.name)) + if not self.receiver_not_member and self.partner_id_to.is_company \ + and not self.share_product_id.by_company: + raise ValidationError(_("This share can not be" + " subscribed by a company")) + if not self.receiver_not_member and not self.partner_id_to.is_company \ + and not self.share_product_id.by_individual: + raise ValidationError(_("This share can not be" + " subscribed an individual")) if self.receiver_not_member and self.subscription_request \ and not self.subscription_request.validated: raise ValidationError(_("The information of the receiver" From b6bee7d98cfdfe9a6059811aaea5928945e9cc59 Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Tue, 31 Mar 2020 14:49:56 +0200 Subject: [PATCH 2/2] fixup! [FIX] emc: check share to_company and to_individual on transfer --- easy_my_coop/models/operation_request.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easy_my_coop/models/operation_request.py b/easy_my_coop/models/operation_request.py index 3d493c3..1075439 100644 --- a/easy_my_coop/models/operation_request.py +++ b/easy_my_coop/models/operation_request.py @@ -200,11 +200,11 @@ class operation_request(models.Model): raise ValidationError(_("This share type could not be" " transfered to " + self.partner_id_to.name)) - if not self.receiver_not_member and self.partner_id_to.is_company \ + if self.partner_id_to.is_company \ and not self.share_product_id.by_company: raise ValidationError(_("This share can not be" " subscribed by a company")) - if not self.receiver_not_member and not self.partner_id_to.is_company \ + if not self.partner_id_to.is_company \ and not self.share_product_id.by_individual: raise ValidationError(_("This share can not be" " subscribed an individual"))