diff --git a/easy_my_coop_loan/__manifest__.py b/easy_my_coop_loan/__manifest__.py
index b7e6c5b..8ef2def 100644
--- a/easy_my_coop_loan/__manifest__.py
+++ b/easy_my_coop_loan/__manifest__.py
@@ -24,6 +24,7 @@
"report/loan_issue_line_report.xml",
"report/loan_report.xml",
"data/mail_template_data.xml",
+ "data/loan_data.xml"
],
"demo": [
"demo/coop.xml"
diff --git a/easy_my_coop_loan/data/loan_data.xml b/easy_my_coop_loan/data/loan_data.xml
new file mode 100644
index 0000000..cfa4dd5
--- /dev/null
+++ b/easy_my_coop_loan/data/loan_data.xml
@@ -0,0 +1,12 @@
+
+
+ Loan issue line
+ loan.issue.line.sequence
+ LOAN/%(year)s/
+
+
+
+
+ 4
+
+
\ No newline at end of file
diff --git a/easy_my_coop_loan/models/loan_issue_line.py b/easy_my_coop_loan/models/loan_issue_line.py
index db0c2d3..6fb5164 100644
--- a/easy_my_coop_loan/models/loan_issue_line.py
+++ b/easy_my_coop_loan/models/loan_issue_line.py
@@ -21,7 +21,8 @@ class LoanIssueLine(models.Model):
line.amount = line.face_value * line.quantity
name = fields.Char(
- String="Name"
+ String="Name",
+ readonly=True,
)
reference = fields.Char(
string="Reference",
@@ -112,8 +113,13 @@ class LoanIssueLine(models.Model):
@api.multi
def action_validate(self):
+ sequence_id = self.env.ref(
+ "easy_my_coop_loan.sequence_loan_issue_line",
+ False
+ )
for line in self:
- line.write({"state": "subscribed"})
+ loan_line_num = sequence_id.next_by_id()
+ line.write({"name": loan_line_num, "state": "subscribed"})
@api.multi
def action_request_payment(self):
@@ -202,7 +208,7 @@ class LoanIssueLine(models.Model):
days = self.get_number_of_days(line.payment_date.year)
interim_amount = line.amount * rate * (diff_days / days)
- due_date = start_date + relativedelta(years=+loan_term)
+ due_date = start_date + relativedelta(years=loan_term)
for year in range(1, loan_term + 1):
interest = accrued_amount * rate
diff --git a/easy_my_coop_loan/views/loan_line_view.xml b/easy_my_coop_loan/views/loan_line_view.xml
index b34201c..c4b0dfa 100644
--- a/easy_my_coop_loan/views/loan_line_view.xml
+++ b/easy_my_coop_loan/views/loan_line_view.xml
@@ -11,6 +11,7 @@
loan.issue.line
+
@@ -48,6 +49,7 @@
+