diff --git a/golem_family/__init__.py b/golem_family/__init__.py new file mode 100644 index 0000000..2fca3d2 --- /dev/null +++ b/golem_family/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Fabien Bourgeois +# +# 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 . + +from . import models diff --git a/golem_family/__openerp__.py b/golem_family/__openerp__.py new file mode 100644 index 0000000..651e45a --- /dev/null +++ b/golem_family/__openerp__.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Fabien Bourgeois +# +# 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 . + +{ + 'name': 'GOLEM families', + 'summary': 'GOLEM Members Families', + 'description': ''' Non-profit french MJC members families management ''', + 'version': '0.1', + 'category': 'Non-profit management', + 'author': 'Fabien Bourgeois', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'depends': ['golem_member'], + 'data': ['views/golem_member_view.xml'] +} diff --git a/golem_family/models/__init__.py b/golem_family/models/__init__.py new file mode 100644 index 0000000..a3bc65d --- /dev/null +++ b/golem_family/models/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Fabien Bourgeois +# +# 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 . + +from . import golem_family diff --git a/golem_family/models/golem_family.py b/golem_family/models/golem_family.py new file mode 100644 index 0000000..1b1a663 --- /dev/null +++ b/golem_family/models/golem_family.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Fabien Bourgeois +# +# 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 . + +from openerp import models, fields + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + family_ids = fields.Many2many('golem.member.family', + string='Family member') + + # @api.multi + # def button_family_members(self): + # self.ensure_one() + # return {'name': _('Family Members'), + # 'type': 'ir.actions.act_window', + # 'res_model': 'golem.member.family', + # 'view_mode': 'tree', + # 'domain': [('memberfrom_id', '=', self[0].id)]} + + +class GolemFamily(models.Model): + _name = 'golem.member.family' + _description = 'GOLEM Member Family' + + memberfrom_id = fields.Many2one('golem.member', 'Family member 1') + memberto_id = fields.Many2one('golem.member', string='Family member 2') + relation_id = fields.Many2one('golem.member.family.relation', + string='Family relation') + + # @api.onchange('member_id') + # def onchange_member_id(self): + # mid = self.env.context.get('default_member_id') + # member = self.env['golem.member'].browse([mid]) + # self.member_id = member.partner_id.id + # return self + + +class GolemFamilyRelation(models.Model): + _name = 'golem.member.family.relation' + _description = 'GOLEM Member Family Relation' + _sql_constraints = [('golem_member_family_relation_name_uniq', + 'UNIQUE (name)', + 'Family relation must be unique.')] + + name = fields.Char('Relation') diff --git a/golem_family/views/golem_member_view.xml b/golem_family/views/golem_member_view.xml new file mode 100644 index 0000000..d16928b --- /dev/null +++ b/golem_family/views/golem_member_view.xml @@ -0,0 +1,76 @@ + + + + + + + + + Add family management to new tab + golem.member + + + + + + + + + + + + + + Family list + golem.member.family + + + + + + + + + + + + + + + + + +