GOLEM/golem_member_history/models/golem_member_history.py

48 lines
2.3 KiB
Python
Raw Normal View History

2018-10-18 11:07:03 +02:00
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Member History Management """
from odoo import models, fields, _
2018-10-18 11:07:03 +02:00
class GolemMemberHistory(models.Model):
""" GOLEM Member History """
_name = 'golem.member.history'
_description = 'GOLEM Member History Management'
_order = 'season_id desc, id desc'
_sql_constraints = [('golem_member_history_member_season_uniq',
'UNIQUE (member_id, season_id)',
_('You can only have one history line for each '
'member and season combination.'))]
2018-10-18 11:07:03 +02:00
member_id = fields.Many2one('golem.member', required=True, auto_join=True,
string='Service user', ondelete='cascade')
2018-10-18 11:07:03 +02:00
season_id = fields.Many2one('golem.season', required=True, auto_join=True,
string='Season', ondelete='cascade')
2018-10-18 11:07:03 +02:00
gender = fields.Selection([('male', _('Male')), ('female', _('Female'))])
area_id = fields.Many2one('golem.partner.area', string='Area',
auto_join=True, ondelete='cascade')
zip_code = fields.Char(string='ZIP')
2018-10-18 11:07:03 +02:00
city = fields.Char()
2018-10-18 12:58:50 +02:00
family_quotient = fields.Monetary()
currency_id = fields.Many2one(related='member_id.currency_id',
string='Currency', readonly=True)
2018-10-18 18:05:31 +02:00
pcs_id = fields.Many2one('golem.pcs', string='PCS')
nationality_id = fields.Many2one('res.country', string='Nationality',
auto_join=True, ondelete='cascade')