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.

83 lines
4.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2019 Coop IT Easy SCRL fs
  3. # Houssine Bakkali <houssine@coopiteasy.be>
  4. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  5. from odoo import api, fields, models
  6. class ResCompany(models.Model):
  7. _inherit = 'res.company'
  8. def _get_base_logo(self):
  9. base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
  10. self.logo_url = base_url + "/logo.png"
  11. coop_email_contact = fields.Char(string="Contact email address for the"
  12. " cooperator")
  13. subscription_maximum_amount = fields.Float(string="Maximum authorised"
  14. " subscription amount")
  15. default_country_id = fields.Many2one('res.country',
  16. string="Default country",
  17. default=lambda self: self.country_id)
  18. default_lang_id = fields.Many2one('res.lang',
  19. string="Default lang")
  20. allow_id_card_upload = fields.Boolean(string="Allow ID Card upload")
  21. create_user = fields.Boolean(string="Create user for cooperator",
  22. default=False)
  23. board_representative = fields.Char(string="Board representative name")
  24. signature_scan = fields.Binary(string="Board representative signature")
  25. property_cooperator_account = fields.Many2one('account.account',
  26. company_dependent=True,
  27. string="Cooperator Account",
  28. domain=[('internal_type', '=', 'receivable'),
  29. ('deprecated', '=', False)],
  30. help="This account will be"
  31. " the default one as the"
  32. " receivable account for the"
  33. " cooperators",
  34. required=True)
  35. unmix_share_type = fields.Boolean(string="Unmix share type",
  36. default=True,
  37. help="If checked, A cooperator will be"
  38. " authorised to have only one type"
  39. " of share")
  40. display_logo1 = fields.Boolean(string="Display logo 1")
  41. display_logo2 = fields.Boolean(string="Display logo 2")
  42. bottom_logo1 = fields.Binary(string="Bottom logo 1")
  43. bottom_logo2 = fields.Binary(string="Bottom logo 2")
  44. logo_url = fields.Char(string="logo url",
  45. compute="_get_base_logo")
  46. display_data_policy_approval = fields.Boolean(
  47. help="Choose to display a data policy checkbox on the cooperator"
  48. " website form."
  49. )
  50. data_policy_approval_required = fields.Boolean(
  51. string="Is data policy approval required?"
  52. )
  53. data_policy_approval_text = fields.Html(
  54. translate=True,
  55. help="Text to display aside the checkbox to approve data policy."
  56. )
  57. display_internal_rules_approval = fields.Boolean(
  58. help="Choose to display an internal rules checkbox on the"
  59. " cooperator website form."
  60. )
  61. internal_rules_approval_required = fields.Boolean(
  62. string="Is internal rules approval required?"
  63. )
  64. internal_rules_approval_text = fields.Html(
  65. translate=True,
  66. help="Text to display aside the checkbox to approve internal rules."
  67. )
  68. @api.onchange('data_policy_approval_required')
  69. def onchange_data_policy_approval_required(self):
  70. if self.data_policy_approval_required:
  71. self.display_data_policy_approval = True
  72. @api.onchange('internal_rules_approval_required')
  73. def onchange_internal_rules_approval_required(self):
  74. if self.internal_rules_approval_required:
  75. self.display_internal_rules_approval = True