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.

66 lines
2.1 KiB

  1. # -*- coding: utf-8 -*-
  2. '''Define model res.partner.relation.type'''
  3. ##############################################################################
  4. #
  5. # OpenERP, Open Source Management Solution
  6. # This module copyright (C) 2013 Therp BV (<http://therp.nl>).
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License as
  10. # published by the Free Software Foundation, either version 3 of the
  11. # License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Affero General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. ##############################################################################
  22. from openerp import models, fields, api, _
  23. class ResPartnerRelationType(models.Model):
  24. """Model that defines relation types that might exist between partners"""
  25. _name = 'res.partner.relation.type'
  26. _description = 'Partner Relation Type'
  27. _order = 'name'
  28. name = fields.Char(
  29. 'Name',
  30. size=128,
  31. required=True,
  32. translate=True,
  33. )
  34. name_inverse = fields.Char(
  35. 'Inverse name',
  36. size=128,
  37. required=True,
  38. translate=True,
  39. )
  40. contact_type_left = fields.Selection(
  41. '_get_partner_types',
  42. 'Left partner type',
  43. )
  44. contact_type_right = fields.Selection(
  45. '_get_partner_types',
  46. 'Right partner type',
  47. )
  48. partner_category_left = fields.Many2one(
  49. 'res.partner.category',
  50. 'Left partner category',
  51. )
  52. partner_category_right = fields.Many2one(
  53. 'res.partner.category',
  54. 'Right partner category',
  55. )
  56. @api.model
  57. def _get_partner_types(self):
  58. return [
  59. ('c', _('Company')),
  60. ('p', _('Person')),
  61. ]