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.

46 lines
1.6 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014 AvancOSC - Daniel Campos
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import api, fields, models
  5. class Partner(models.Model):
  6. _inherit = 'res.partner'
  7. company_credit_limit = fields.Float(
  8. string='Company\'s Credit Limit',
  9. help='Credit limit granted by the company.',
  10. )
  11. insurance_credit_limit = fields.Float(
  12. string='Insurance\'s Credit Limit',
  13. help='Credit limit granted by the insurance company.',
  14. )
  15. risk_insurance_coverage_percent = fields.Float(
  16. string='Insurance\'s Credit Coverage',
  17. help='Percentage of the credit covered by the insurance.',
  18. )
  19. risk_insurance_requested = fields.Boolean(
  20. string='Insurance Requested',
  21. help='Mark this field if an insurance was requested for the credit of '
  22. 'this partner.',
  23. )
  24. risk_insurance_grant_date = fields.Date(
  25. string='Insurance Grant Date',
  26. help='Date when the insurance was granted by the insurance company.',
  27. )
  28. risk_insurance_code = fields.Char(
  29. string='Insurance Code',
  30. help='Code assigned to this partner by the risk insurance company.',
  31. )
  32. risk_insurance_code_2 = fields.Char(
  33. string='Insurance Code 2',
  34. help='Secondary code assigned to this partner by the risk insurance '
  35. 'company.',
  36. )
  37. @api.onchange('insurance_credit_limit', 'company_credit_limit')
  38. def _onchage_insurance_credit_limit(self):
  39. self.ensure_one()
  40. self.credit_limit = (self.insurance_credit_limit +
  41. self.company_credit_limit)