Browse Source

Merge 8e36729a2b into 1dab475f36

pull/144/merge
vvrossem 4 years ago
committed by GitHub
parent
commit
3305e0cc65
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      easy_my_coop_loan/__manifest__.py
  2. 24
      easy_my_coop_loan/models/loan.py
  3. 2
      easy_my_coop_loan/views/loan_view.xml

2
easy_my_coop_loan/__manifest__.py

@ -4,7 +4,7 @@
{
"name": "Easy My Coop Bond and Subordinated Loan Issues",
"version": "12.0.1.0.1",
"version": "12.0.1.0.2",
"depends": ["easy_my_coop"],
"author": "Coop IT Easy SCRLfs",
"category": "Cooperative management",

24
easy_my_coop_loan/models/loan.py

@ -14,14 +14,17 @@ class LoanIssue(models.Model):
_description = "Loan Issue"
@api.multi
def _compute_subscribed_amount(self):
def _compute_amounts(self):
for issue in self:
susbscribed_amount = 0.0
for line in issue.loan_issue_lines.filtered(
lambda record: record.state != "cancelled"
):
susbscribed_amount += line.amount
issue.subscribed_amount = susbscribed_amount
subscription_lines = issue.loan_issue_lines.filtered(
lambda line: line.state != "cancelled"
)
issue.subscribed_amount = sum(subscription_lines.mapped("amount"))
paid_lines = issue.loan_issue_lines.filtered(
lambda line: line.state == "paid"
)
issue.paid_amount = sum(paid_lines.mapped("amount"))
name = fields.Char(string="Name", translate=True)
default_issue = fields.Boolean(string="Default issue")
@ -63,7 +66,12 @@ class LoanIssue(models.Model):
)
subscribed_amount = fields.Monetary(
string="Subscribed amount",
compute="_compute_subscribed_amount",
compute="_compute_amounts",
currency_field="company_currency_id",
)
paid_amount = fields.Monetary(
string="Paid amount",
compute="_compute_amounts",
currency_field="company_currency_id",
)
interest_payment = fields.Selection(

2
easy_my_coop_loan/views/loan_view.xml

@ -15,6 +15,7 @@
<field name="minimum_amount"/>
<field name="maximum_amount"/>
<field name="subscribed_amount"/>
<field name="paid_amount"/>
<field name="user_id"/>
<field name="state"/>
</tree>
@ -73,6 +74,7 @@
<field name="minimum_amount"/>
<field name="maximum_amount"/>
<field name="subscribed_amount"/>
<field name="paid_amount"/>
<field name="by_individual"/>
<field name="min_amount_person"
attrs="{'invisible':[('by_individual','=',False)]}"/>

Loading…
Cancel
Save