You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.7 KiB

[ADD] bond and loan issues management [ADD] bond and loan issues management module skeleton [IMP] change increase menu sequence [IMP] add models, fields and views [IMP] add xml declaration in head of file [ADD] add easy_my_coop_loan_website - WIP [IMP] add access rights [IMP] this raise inconsistency so replace id by default_code. [IMP] change import openerp to odoo [IMP] add website loan module [FIX] put website display in loan [FIX] fix import [FIX] fix function [IMP] use correct name [IMP] make the loan and bond visible [IMP] add js, field and logic to set amount limit per subscription [IMP] remove dependency on recaptcha as user is logged to subscribe [IMP] add fields [IMP] save loan issue subscription still in WIP [IMP] remove alert pop up [IMP] add dependency to easy_my_coop_website [IMP] remove force send for sub request creation email notification [IMP] add mail templates [IMP] save subscription in the corresponding loan issue. add email notif [FIX] fix loan issue line view [FIX] add related field to loan issue. It is where the data stand [IMP] move term_view up [FIX] fix js error when false is returned [FIX] fix function when loan_issue_id in None [IMP] add actions and button [FIX] fix action [FIX] fix mail template [IMP] set noupdate=1 [IMP] change order [IMP] display loan issue lines on partner form [IMP] add loan view in partner form [IMP] add face value on loan issue and line add face value on loan issue and line. add as well the quantity and computation of the amount [FIX] missing id overriding values wasn't working [IMP] getting bond face value and setting it as step. [IMP] subscribed_amount computed field is the sum of the amount lines [IMP] allow a waiting payment to be cancelled [IMP] make field required [REFACT] move loan issue line code to dedicated file [IMP] add interest calculation and model [ADD] bond and loan issues management module skeleton [IMP] add models, fields and views [IMP] allow creation by hand [IMP] adding partner related field [IMP] put code in separate function [FIX] pass it to get method [IMP] routes consistent form [FIX] fix eof [FIX] GET is working for ajax call [IMP] website page for loan issue subscription
5 years ago
[ADD] bond and loan issues management [ADD] bond and loan issues management module skeleton [IMP] change increase menu sequence [IMP] add models, fields and views [IMP] add xml declaration in head of file [ADD] add easy_my_coop_loan_website - WIP [IMP] add access rights [IMP] this raise inconsistency so replace id by default_code. [IMP] change import openerp to odoo [IMP] add website loan module [FIX] put website display in loan [FIX] fix import [FIX] fix function [IMP] use correct name [IMP] make the loan and bond visible [IMP] add js, field and logic to set amount limit per subscription [IMP] remove dependency on recaptcha as user is logged to subscribe [IMP] add fields [IMP] save loan issue subscription still in WIP [IMP] remove alert pop up [IMP] add dependency to easy_my_coop_website [IMP] remove force send for sub request creation email notification [IMP] add mail templates [IMP] save subscription in the corresponding loan issue. add email notif [FIX] fix loan issue line view [FIX] add related field to loan issue. It is where the data stand [IMP] move term_view up [FIX] fix js error when false is returned [FIX] fix function when loan_issue_id in None [IMP] add actions and button [FIX] fix action [FIX] fix mail template [IMP] set noupdate=1 [IMP] change order [IMP] display loan issue lines on partner form [IMP] add loan view in partner form [IMP] add face value on loan issue and line add face value on loan issue and line. add as well the quantity and computation of the amount [FIX] missing id overriding values wasn't working [IMP] getting bond face value and setting it as step. [IMP] subscribed_amount computed field is the sum of the amount lines [IMP] allow a waiting payment to be cancelled [IMP] make field required [REFACT] move loan issue line code to dedicated file [IMP] add interest calculation and model [ADD] bond and loan issues management module skeleton [IMP] add models, fields and views [IMP] allow creation by hand [IMP] adding partner related field [IMP] put code in separate function [FIX] pass it to get method [IMP] routes consistent form [FIX] fix eof [FIX] GET is working for ajax call [IMP] website page for loan issue subscription
5 years ago
  1. from datetime import datetime
  2. from odoo import api, fields, models
  3. class LoanIssueLine(models.Model):
  4. _name = 'loan.issue.line'
  5. _description = 'Loan Issue Line'
  6. _order = 'date desc, id'
  7. @api.multi
  8. @api.depends('quantity', 'face_value')
  9. def _compute_amount(self):
  10. for line in self:
  11. line.amount = line.face_value * line.quantity
  12. name = fields.Char(string="Reference")
  13. loan_issue_id = fields.Many2one('loan.issue',
  14. string="Loan issue",
  15. required=True)
  16. interest_lines = fields.One2many('loan.interest.line',
  17. 'issue_line',
  18. string="Interest lines")
  19. quantity = fields.Integer(string='quantity',
  20. required=True)
  21. face_value = fields.Monetary(related='loan_issue_id.face_value',
  22. currency_field='company_currency_id',
  23. store=True,
  24. readonly=True)
  25. partner_id = fields.Many2one('res.partner',
  26. string="Subscriber",
  27. required=True)
  28. date = fields.Date(string="Subscription date",
  29. default=lambda self: datetime.strftime(datetime.now(),
  30. '%Y-%m-%d'),
  31. required=True)
  32. amount = fields.Monetary(string="Subscribed amount",
  33. currency_field='company_currency_id',
  34. compute='_compute_amount',
  35. store=True)
  36. state = fields.Selection([('draft', 'Draft'),
  37. ('subscribed', 'Subscribed'),
  38. ('waiting', 'Waiting payment'),
  39. ('paid', 'paid'),
  40. ('cancelled', 'Cancelled'),
  41. ('ended', 'Ended')],
  42. string="State",
  43. required=True,
  44. default="draft")
  45. company_currency_id = fields.Many2one('res.currency',
  46. related='company_id.currency_id',
  47. string="Company Currency",
  48. readonly=True)
  49. company_id = fields.Many2one('res.company',
  50. related='loan_issue_id.company_id',
  51. string="Company",
  52. readonly=True)
  53. def create(self, vals):
  54. mail_template = 'easy_my_coop_loan.loan_subscription_confirmation'
  55. confirmation_mail_template = self.env.ref(mail_template, False)
  56. line = super(LoanIssueLine, self).create(vals)
  57. confirmation_mail_template.send_mail(line.id)
  58. return line
  59. @api.multi
  60. def action_draft(self):
  61. for line in self:
  62. line.write({'state': 'draft'})
  63. @api.multi
  64. def action_validate(self):
  65. for line in self:
  66. line.write({'state': 'subscribed'})
  67. @api.multi
  68. def action_request_payment(self):
  69. mail_template = 'easy_my_coop_loan.loan_issue_payment_request'
  70. pay_req_mail_template = self.env.ref(mail_template, False)
  71. for line in self:
  72. pay_req_mail_template.send_mail(line.id)
  73. line.write({'state': 'waiting'})
  74. @api.multi
  75. def action_cancel(self):
  76. for line in self:
  77. line.write({'state': 'cancelled'})
  78. @api.multi
  79. def action_paid(self):
  80. for line in self:
  81. line.write({'state': 'paid'})