Browse Source
Merge pull request #6 from coopiteasy/9.0_fix_operation_conversion
9.0 fix operation conversion
pull/8/head
Houssine BAKKALI
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
2 deletions
-
easy_my_coop/models/operation_request.py
-
easy_my_coop/view/operation_request_view.xml
|
|
@ -175,6 +175,13 @@ class operation_request(models.Model): |
|
|
|
" shares that he/she owns.")) |
|
|
|
|
|
|
|
if self.operation_type == 'convert': |
|
|
|
amount_to_convert = self.share_unit_price * self.quantity |
|
|
|
share_price = self.share_to_product_id.list_price |
|
|
|
remainder = amount_to_convert % share_price |
|
|
|
|
|
|
|
if remainder != 0: |
|
|
|
raise ValidationError(_("The conversion must give a whole" |
|
|
|
" number for quantity")) |
|
|
|
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" |
|
|
|
|
|
@ -32,7 +32,6 @@ |
|
|
|
<sheet> |
|
|
|
<group> |
|
|
|
<group> |
|
|
|
<field name="state"/> |
|
|
|
<field name="request_date" attrs="{'readonly':[('state','!=','draft')]}"/> |
|
|
|
<field name="operation_type" attrs="{'readonly':[('state','!=','draft')]}"/> |
|
|
|
<field name="receiver_not_member" attrs="{'invisible':[('operation_type','!=','transfer')]}"/> |
|
|
|