From 7b15577097b30963b780f3a8e366e8b27dde751f Mon Sep 17 00:00:00 2001 From: houssine Date: Mon, 1 Apr 2019 14:53:50 +0200 Subject: [PATCH] [IMP] raise error for an unimplemented case for shares conversion --- easy_my_coop/models/operation_request.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/easy_my_coop/models/operation_request.py b/easy_my_coop/models/operation_request.py index 2ffddfc..8131e2f 100644 --- a/easy_my_coop/models/operation_request.py +++ b/easy_my_coop/models/operation_request.py @@ -173,15 +173,18 @@ class operation_request(models.Model): raise ValidationError(_("The cooperator can't hand over more" " shares that he/she owns.")) - if self.operation_type == 'convert' and \ - self.company_id.unmix_share_type: + if self.operation_type == 'convert': + if self.company_id.unmix_share_type: if self.share_product_id.code == self.share_to_product_id.code: raise ValidationError(_("You can't convert the share to" " the same share type.")) if self.subscription_amount != self.partner_id.total_value: raise ValidationError(_("You must convert all the shares" " to the selected type.")) - + else: + if self.subscription_amount != self.partner_id.total_value: + raise ValidationError(_("Converting just part of the" + " shares is not yet implemented")) elif self.operation_type == 'transfer': if not self.receiver_not_member and self.company_id.unmix_share_type \ and (self.partner_id_to.cooperator_type