Merge branch 'master' into contacts_enhancements

This commit is contained in:
Fabien BOURGEOIS 2018-11-01 15:08:57 +01:00
commit e68bd4c5b2
50 changed files with 1673 additions and 74 deletions

View File

@ -20,7 +20,7 @@
'name': 'GOLEM Activity Member Registration Payments',
'summary': 'GOLEM Activities Member Registration Payments',
'description': 'GOLEM Activities Member Registration Payments',
'version': '10.0.0.4.1',
'version': '10.0.0.5.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@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
@ -84,13 +85,21 @@ class GolemActivityRegistrationInvoicing(models.TransientModel):
""" Create invoice and lines """
self.ensure_one()
partner = self.member_id.partner_id
#check if there is a draft invoice for the current customer
member_line = partner.member_lines.filtered(
lambda ml: (ml.membership_id.membership_season_id == self.season_id
and ml.account_invoice_id.state == 'draft')
)
if member_line:
invoice = member_line[0].account_invoice_id
else:
invoice = self.env['account.invoice'].create({
'partner_id': partner.id,
'account_id': partner.property_account_receivable_id.id,
'fiscal_position_id': partner.property_account_position_id.id
})
for line in self.line_ids:
product = line.activity_id.product_id
product = line.activity_id.product_id.product_variant_id
invoice_line = self._create_invoice_line(product, line.price, invoice)
line.registration_id.invoice_line_id = invoice_line.id
return invoice

View File

@ -19,7 +19,7 @@
'name': 'GOLEM families',
'summary': 'GOLEM Members Families',
'description': 'GOLEM Members Families',
'version': '10.0.2.4.0',
'version': '10.0.2.5.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El Ouahby',
'license': 'AGPL-3',

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-19 07:03+0000\n"
"PO-Revision-Date: 2018-10-19 09:04+0200\n"
"POT-Creation-Date: 2018-10-26 15:44+0000\n"
"PO-Revision-Date: 2018-10-26 17:45+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -52,6 +52,31 @@ msgstr "<strong>Région</strong> :"
msgid "Address"
msgstr "Adresse"
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_area_id
msgid "Area"
msgstr "Territoire"
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_area_from_street
msgid "Area from street"
msgstr "Territoire automatique depuis la rue"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Area, quarter..."
msgstr "Lieu, quartier..."
#. module: golem_family
#: model:ir.model.fields,help:golem_family.field_golem_family_area_id
msgid "Area, quarter... for statistics and activity price."
msgstr "Lieu, quartier... pour les statistiques et les tarifs des activités."
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_search
msgid "By area"
msgstr "Par territoire"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_search
msgid "By city"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-19 07:03+0000\n"
"PO-Revision-Date: 2018-10-19 07:03+0000\n"
"POT-Creation-Date: 2018-10-26 15:44+0000\n"
"PO-Revision-Date: 2018-10-26 15:44+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -52,6 +52,31 @@ msgstr ""
msgid "Address"
msgstr ""
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_area_id
msgid "Area"
msgstr ""
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_area_from_street
msgid "Area from street"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Area, quarter..."
msgstr ""
#. module: golem_family
#: model:ir.model.fields,help:golem_family.field_golem_family_area_id
msgid "Area, quarter... for statistics and activity price."
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_search
msgid "By area"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_search
msgid "By city"

View File

@ -145,6 +145,12 @@ class GolemFamily(models.Model):
note = fields.Text()
count = fields.Integer(compute='_compute_count', store=True)
area_id = fields.Many2one(
'golem.partner.area', index=True, auto_join=True, string='Area',
help="Area, quarter... for statistics and activity price."
)
area_from_street = fields.Boolean(store=False, default=False)
@api.depends('member_ids')
def _compute_count(self):
for family in self:
@ -161,6 +167,34 @@ class GolemFamily(models.Model):
'zip': family.member_ids[0].zip,
'city': family.member_ids[0].city})
@api.onchange('street')
def onchange_street(self):
""" Area auto assignement """
for family in self:
mstreet = family.street.strip() if family.street else False
if mstreet and not family.area_id:
street_id = self.env['golem.partner.area.street'].search(
[('name', 'ilike', mstreet)], limit=1
)
if street_id:
family.area_id = street_id.area_id
family.area_from_street = True
@api.constrains('street')
def save_street(self):
""" Save street if no exist """
for family in self:
if family.street and not family.area_from_street:
mstreet = family.street.strip()
street_id = self.env['golem.partner.area.street'].search(
[('name', 'ilike', mstreet)]
)
if not street_id:
self.env['golem.partner.area.street'].create(
{'name': mstreet, 'area_id': family.area_id.id}
)
class GolemFamilyRole(models.Model):
""" GOLEM Family Role """
_name = 'golem.family.role'

View File

@ -45,6 +45,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="street" placeholder="Street..." />
<field name="street2" />
<field name="zip" placeholder="ZIP" />
<field name="area_id" placeholder="Area, quarter..."
options="{'no_create': true}" />
<field name="city" placeholder="City" />
</group>
<group>
@ -186,6 +188,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="arch" type="xml">
<search>
<field name="name" />
<field name='area_id' />
<field name="zip" />
<field name="city" />
<field name="phone" />
@ -194,6 +197,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<filter name="single_parent" string="Single-parent"
domain="[('single_parent', '=', True)]" />
<group string="Group By">
<filter name='group_by_area_id' string="By area"
context='{"group_by": "area_id"}'/>
<filter name="group_city" string="By city"
context="{'group_by': 'city'}"/>
</group>

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
# 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
@ -15,15 +16,4 @@
# 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 Family Minor glue module"""
from odoo import models, fields
LEGAL_DMN = "['&', ('family_id', '=', family_id), ('id', '!=', partner_id)]"
class GolemMember(models.Model):
""" Member adaptations """
_inherit = 'golem.member'
legal_guardian_ids = fields.Many2many(domain=LEGAL_DMN)
from . import models

View File

@ -0,0 +1,31 @@
# -*- 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/>.
{
'name': 'GOLEM Families History',
'summary': 'GOLEM Families History',
'description': 'GOLEM Families History',
'version': '10.0.0.1.1',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El ouahby',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': ['golem_family'],
'data': ['security/ir.model.access.csv', 'views/golem_family_views.xml']
}

View File

@ -0,0 +1,114 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_family_history
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 15:44+0000\n"
"PO-Revision-Date: 2018-10-26 17:46+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_area_id
msgid "Area"
msgstr "Territoire"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_city
msgid "City"
msgstr "Ville"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_country_id
msgid "Country"
msgstr "Pays"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_create_date
msgid "Created on"
msgstr "Créé le"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_family_id
msgid "Family"
msgstr "Famille"
#. module: golem_family_history
#: model:ir.model,name:golem_family_history.model_golem_family
msgid "GOLEM Family Entity"
msgstr "Famille"
#. module: golem_family_history
#: model:ir.model,name:golem_family_history.model_golem_family_history
msgid "GOLEM Family History Management"
msgstr "GOLEM Family History Management"
#. module: golem_family_history
#: model:ir.ui.view,arch_db:golem_family_history.golem_family_form_inherit_golem_family_history
msgid "History"
msgstr "Historique"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_family_history_ids
msgid "History details"
msgstr "Historique"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_id
msgid "ID"
msgstr "ID"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_member_ids
msgid "Members"
msgstr "Adhérents"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_season_id
msgid "Season"
msgstr "Saison"
#. module: golem_family_history
#: code:addons/golem_family_history/models/golem_family_history.py:30
#: sql_constraint:golem.family.history:0
#, python-format
msgid "You can only have one history line for each family and season combination."
msgstr "Vous ne pouvez avoir qu'une seule ligne par famille par saison."
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_zip_code
msgid "ZIP"
msgstr "Code postal"

View File

@ -0,0 +1,114 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_family_history
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 15:44+0000\n"
"PO-Revision-Date: 2018-10-26 15:44+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_area_id
msgid "Area"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_city
msgid "City"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_country_id
msgid "Country"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_create_uid
msgid "Created by"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_create_date
msgid "Created on"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_display_name
msgid "Display Name"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_family_id
msgid "Family"
msgstr ""
#. module: golem_family_history
#: model:ir.model,name:golem_family_history.model_golem_family
msgid "GOLEM Family Entity"
msgstr ""
#. module: golem_family_history
#: model:ir.model,name:golem_family_history.model_golem_family_history
msgid "GOLEM Family History Management"
msgstr ""
#. module: golem_family_history
#: model:ir.ui.view,arch_db:golem_family_history.golem_family_form_inherit_golem_family_history
msgid "History"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_family_history_ids
msgid "History details"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_id
msgid "ID"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history___last_update
msgid "Last Modified on"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_write_uid
msgid "Last Updated by"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_write_date
msgid "Last Updated on"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_member_ids
msgid "Members"
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_season_id
msgid "Season"
msgstr ""
#. module: golem_family_history
#: code:addons/golem_family_history/models/golem_family_history.py:30
#: sql_constraint:golem.family.history:0
#, python-format
msgid "You can only have one history line for each family and season combination."
msgstr ""
#. module: golem_family_history
#: model:ir.model.fields,field_description:golem_family_history.field_golem_family_history_zip_code
msgid "ZIP"
msgstr ""

View File

@ -0,0 +1,19 @@
# -*- 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/>.
from . import golem_family_history, golem_family

View File

@ -0,0 +1,51 @@
# -*- 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 Families Adaptations"""
from odoo import models, fields, api
class GolemFamily(models.Model):
""" GOLEM Family Adaptations """
_inherit = 'golem.family'
family_history_ids = fields.One2many('golem.family.history', 'family_id',
readonly=True, string='History details')
@api.constrains('area_id', 'zip', 'city', 'country_id', 'member_ids')
def save_family_history(self):
""" Saves family history """
default_season = self.env['golem.season'].search([('is_default', '=', True)], limit=1)
for family in self:
history_id = self.env['golem.family.history'].search([
('family_id', '=', family.id),
('season_id', '=', default_season.id)], limit=1)
history_data = {
'zip_code': family.zip,
'area_id': family.area_id.id,
'city': family.city,
'country_id': family.country_id.id,
'member_ids':[(6, False, family.member_ids.ids)]
}
if history_id:
history_id.write(history_data)
else:
history_data.update({'family_id': family.id,
'season_id': default_season.id})
self.env['golem.family.history'].create(history_data)

View File

@ -0,0 +1,43 @@
# -*- 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 Family History Management """
from odoo import models, fields, _
class GolemFamilyHistory(models.Model):
""" GOLEM Family History Management """
_name = 'golem.family.history'
_description = 'GOLEM Family History Management'
_order = 'season_id desc, id desc'
_sql_constraints = [('golem_family_history_family_season_uniq',
'UNIQUE (family_id, season_id)',
_('You can only have one history line for each '
'family and season combination.'))]
family_id = fields.Many2one('golem.family', required=True, auto_join=True,
string='Family', ondelete='cascade')
season_id = fields.Many2one('golem.season', required=True, auto_join=True,
string='Season', ondelete='cascade')
zip_code = fields.Char(string='ZIP')
area_id = fields.Many2one('golem.partner.area', string='Area',
auto_join=True, ondelete='cascade')
city = fields.Char()
country_id = fields.Many2one('res.country', string='Country')
member_ids = fields.Many2many('res.partner', string='Members',
auto_join=True)

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_family_history_user,Access GOLEM Family History User,model_golem_family_history,golem_base.group_golem_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_family_history_user Access GOLEM Family History User model_golem_family_history golem_base.group_golem_user 1 1 1 1

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="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/>.
-->
<odoo>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="golem_family_form_inherit_golem_family_history">
<field name="name">Golem Family form history adaptations</field>
<field name="model">golem.family</field>
<field name="inherit_id" ref="golem_family.golem_family_form" />
<field name="arch" type="xml">
<page name="others" position="before">
<page name="history" string="History">
<field name="family_history_ids" readonly="1">
<tree>
<field name="season_id"/>
<field name="member_ids"/>
<field name="area_id"/>
<field name="zip_code"/>
<field name="city"/>
<field name="country_id"/>
</tree>
</field>
</page>
</page>
</field>
</record>
</data>
</odoo>

View File

@ -20,7 +20,7 @@
'name': 'GOLEM Family Memberships',
'summary': 'GOLEM Family Membership Management',
'description': 'GOLEM Family Membership Management',
'version': '10.0.0.1.0',
'version': '10.0.0.1.1',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef ELOUAHBY',
'license': 'AGPL-3',

View File

@ -25,10 +25,9 @@ class GolemMembershipInvoice(models.TransientModel):
_inherit = 'golem.membership.invoice'
family_id = fields.Many2one('golem.family', string='Family',
required=True, ondelete='cascade')
ondelete='cascade')
member_ids = fields.Many2many('res.partner', string='Concerned members')
on_the_name_of = fields.Many2one('res.partner', ondelete='cascade',
required=True)
on_the_name_of = fields.Many2one('res.partner', ondelete='cascade')
@api.onchange('family_id')
def onchange_family(self):

View File

@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="member_ids" widget="many2many_tags"
options="{'no_create': True}" />
<field name="on_the_name_of" options="{'no_create': True}"
attrs="{'readonly': [('member_ids', '=', [])]}" />
attrs="{'readonly': [('member_ids', '=', [])], 'required': [('family_id', '!=', False)]}" />
<field name="product_id" domain="[('family_membership','=',True)]"
widget="selection" />
<field name="member_price" />

View File

@ -14,5 +14,3 @@
#
# 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/>.
from . import golem_member

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2016-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
@ -18,7 +18,7 @@
{
'name': 'GOLEM members minor and family',
'summary': 'GOLEM non-profit members family + minor management',
'version': '10.0.1.0.0',
'version': '10.0.1.1.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-22 16:02+0000\n"
"PO-Revision-Date: 2018-10-22 18:09+0200\n"
"POT-Creation-Date: 2018-10-26 15:43+0000\n"
"PO-Revision-Date: 2018-10-26 17:47+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -67,6 +67,7 @@ msgstr "Appliquer pour les nouveaux adhérents"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_area_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_area_id
#: model:ir.model.fields,field_description:golem_member.field_res_partner_area_id
#: model:ir.model.fields,field_description:golem_member.field_res_users_area_id
msgid "Area"
@ -79,11 +80,6 @@ msgstr "Territoire"
msgid "Area from street"
msgstr "Territoire automatique depuis la rue"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_area_id
msgid "Area id"
msgstr "Territoire"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
#: model:ir.ui.view,arch_db:golem_member.res_partner_form_inherit_golem_member

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-22 16:02+0000\n"
"PO-Revision-Date: 2018-10-22 16:02+0000\n"
"POT-Creation-Date: 2018-10-26 15:43+0000\n"
"PO-Revision-Date: 2018-10-26 15:43+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -67,6 +67,7 @@ msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_area_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_area_id
#: model:ir.model.fields,field_description:golem_member.field_res_partner_area_id
#: model:ir.model.fields,field_description:golem_member.field_res_users_area_id
msgid "Area"
@ -79,11 +80,6 @@ msgstr ""
msgid "Area from street"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_area_id
msgid "Area id"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
#: model:ir.ui.view,arch_db:golem_member.res_partner_form_inherit_golem_member

View File

@ -79,7 +79,7 @@ class GolemPartnerAreaStreet(models.Model):
_description = 'GOLEM Partner Area Street'
name = fields.Char(required=True)
area_id = fields.Many2one('golem.partner.area', required=True, sring='Area',
area_id = fields.Many2one('golem.partner.area', required=True, string='Area',
index=True, auto_join=True, ondelete='set null')

View File

@ -0,0 +1,19 @@
# -*- 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/>.
from . import models

View File

@ -0,0 +1,30 @@
# -*- 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/>.
{
'name': 'GOLEM Member History',
'summary': 'Member History',
'version': '10.0.0.1.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El ouahby',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': ['golem_member', 'golem_pcs', 'golem_member_familyquotient'],
'data': ['security/ir.model.access.csv', 'views/golem_member_views.xml']
}

View File

@ -0,0 +1,148 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_member_history
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 06:41+0000\n"
"PO-Revision-Date: 2018-10-26 08:45+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_area_id
msgid "Area"
msgstr "Territoire"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_city
msgid "City"
msgstr "Ville"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_create_date
msgid "Created on"
msgstr "Créé le"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_currency_id
msgid "Currency"
msgstr "Devise"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_family_quotient
msgid "Family quotient"
msgstr "Quotient familial"
#. module: golem_member_history
#: code:addons/golem_member_history/models/golem_member_history.py:37
#: selection:golem.member.history,gender:0
#, python-format
msgid "Female"
msgstr "Féminin"
#. module: golem_member_history
#: model:ir.model,name:golem_member_history.model_golem_member
msgid "GOLEM Member"
msgstr "Adhérent"
#. module: golem_member_history
#: model:ir.model,name:golem_member_history.model_golem_member_history
msgid "GOLEM Member History Management"
msgstr "GOLEM Member History Management"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_gender
msgid "Gender"
msgstr "Genre"
#. module: golem_member_history
#: model:ir.ui.view,arch_db:golem_member_history.golem_member_form_inherit_golem_member_history
msgid "History"
msgstr "Historique"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_member_history_ids
msgid "History details"
msgstr "Historique"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_id
msgid "ID"
msgstr "ID"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: golem_member_history
#: code:addons/golem_member_history/models/golem_member_history.py:37
#: selection:golem.member.history,gender:0
#, python-format
msgid "Male"
msgstr "Masculin"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_nationality_id
msgid "Nationality"
msgstr "Nationalité"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_pcs_id
msgid "PCS"
msgstr "PCS"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_season_id
msgid "Season"
msgstr "Saison"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_member_id
msgid "Service user"
msgstr "Usager"
#. module: golem_member_history
#: model:ir.model.fields,help:golem_member_history.field_golem_member_history_currency_id
msgid "Utility field to express amount currency"
msgstr "Champ utile pour indiquer le montant de la monnaie"
#. module: golem_member_history
#: code:addons/golem_member_history/models/golem_member_history.py:30
#: sql_constraint:golem.member.history:0
#, python-format
msgid "You can only have one history line for each member and season combination."
msgstr "Vous ne pouvez avoir qu'une seule ligne par usager par saison."
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_zip_code
msgid "ZIP"
msgstr "Code postal"

View File

@ -0,0 +1,148 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_member_history
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 06:41+0000\n"
"PO-Revision-Date: 2018-10-26 06:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_area_id
msgid "Area"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_city
msgid "City"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_create_uid
msgid "Created by"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_create_date
msgid "Created on"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_currency_id
msgid "Currency"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_display_name
msgid "Display Name"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_family_quotient
msgid "Family quotient"
msgstr ""
#. module: golem_member_history
#: code:addons/golem_member_history/models/golem_member_history.py:37
#: selection:golem.member.history,gender:0
#, python-format
msgid "Female"
msgstr ""
#. module: golem_member_history
#: model:ir.model,name:golem_member_history.model_golem_member
msgid "GOLEM Member"
msgstr ""
#. module: golem_member_history
#: model:ir.model,name:golem_member_history.model_golem_member_history
msgid "GOLEM Member History Management"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_gender
msgid "Gender"
msgstr ""
#. module: golem_member_history
#: model:ir.ui.view,arch_db:golem_member_history.golem_member_form_inherit_golem_member_history
msgid "History"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_member_history_ids
msgid "History details"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_id
msgid "ID"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history___last_update
msgid "Last Modified on"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_write_uid
msgid "Last Updated by"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_write_date
msgid "Last Updated on"
msgstr ""
#. module: golem_member_history
#: code:addons/golem_member_history/models/golem_member_history.py:37
#: selection:golem.member.history,gender:0
#, python-format
msgid "Male"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_nationality_id
msgid "Nationality"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_pcs_id
msgid "PCS"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_season_id
msgid "Season"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_member_id
msgid "Service user"
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,help:golem_member_history.field_golem_member_history_currency_id
msgid "Utility field to express amount currency"
msgstr ""
#. module: golem_member_history
#: code:addons/golem_member_history/models/golem_member_history.py:30
#: sql_constraint:golem.member.history:0
#, python-format
msgid "You can only have one history line for each member and season combination."
msgstr ""
#. module: golem_member_history
#: model:ir.model.fields,field_description:golem_member_history.field_golem_member_history_zip_code
msgid "ZIP"
msgstr ""

View File

@ -0,0 +1,19 @@
# -*- 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/>.
from . import golem_member_history, golem_member

View File

@ -0,0 +1,52 @@
# -*- 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 adaptations """
from odoo import models, fields, api
class GolemMember(models.Model):
""" GOLEM Member adaptations """
_inherit = 'golem.member'
member_history_ids = fields.One2many('golem.member.history', 'member_id',
readonly=True, string='History details')
@api.constrains('gender', 'area_id', 'zip', 'city', 'family_quotient',
'pcs_id', 'nationality_id', 'season_ids')
def save_history(self):
""" Saves member history """
default_season = self.env['golem.season'].search([('is_default', '=', True)], limit=1)
for member in self:
history_id = self.env['golem.member.history'].search([
('member_id', '=', member.id),
('season_id', '=', default_season.id)], limit=1)
history_data = {'gender': member.gender,
'nationality_id': member.nationality_id.id,
'zip_code': member.zip,
'city': member.city,
'family_quotient': member.family_quotient,
'pcs_id': member.pcs_id.id,
'area_id': member.area_id.id}
if history_id:
history_id.write(history_data)
else:
history_data.update({'member_id': member.id,
'season_id': default_season.id})
self.env['golem.member.history'].create(history_data)

View File

@ -0,0 +1,47 @@
# -*- 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, _
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.'))]
member_id = fields.Many2one('golem.member', required=True, auto_join=True,
string='Service user', ondelete='cascade')
season_id = fields.Many2one('golem.season', required=True, auto_join=True,
string='Season', ondelete='cascade')
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')
city = fields.Char()
family_quotient = fields.Monetary()
currency_id = fields.Many2one(related='member_id.currency_id',
string='Currency', readonly=True)
pcs_id = fields.Many2one('golem.pcs', string='PCS')
nationality_id = fields.Many2one('res.country', string='Nationality',
auto_join=True, ondelete='cascade')

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_member_history_user,Access GOLEM Member History User,model_golem_member_history,golem_base.group_golem_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_member_history_user Access GOLEM Member History User model_golem_member_history golem_base.group_golem_user 1 1 1 1

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="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/>.
-->
<odoo>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="golem_member_form_inherit_golem_member_history">
<field name="name">GOLEM Member Form history adaptations</field>
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_form" />
<field name="arch" type="xml">
<page name="membership" position="after">
<page name="history" string="History">
<field name="member_history_ids" readonly="1">
<tree>
<field name="season_id"/>
<field name="gender"/>
<field name="pcs_id"/>
<field name="area_id"/>
<field name="zip_code"/>
<field name="city"/>
<field name="nationality_id"/>
</tree>
</field>
</page>
</page>
</field>
</record>
</data>
</odoo>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2017-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
@ -15,4 +15,4 @@
# 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/>.
from . import models
from . import models, wizard

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@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
@ -18,12 +19,15 @@
{
'name': 'GOLEM members minor',
'summary': 'GOLEM non-profit members minor management',
'version': '10.0.1.1.0',
'version': '10.0.1.3.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': ['golem_member'],
'data': ['views/golem_member_views.xml']
'data': ['security/ir.model.access.csv',
'views/golem_member_views.xml',
'views/account_invoice.xml',
'wizard/golem_membership_invoice.xml']
}

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-26 16:15+0000\n"
"PO-Revision-Date: 2018-08-26 18:15+0200\n"
"POT-Creation-Date: 2018-10-25 15:51+0000\n"
"PO-Revision-Date: 2018-10-25 17:52+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -25,33 +25,148 @@ msgstr "Participation aux activités?"
msgid "Can leave alone?"
msgstr "Peut quitter la structure seul?"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_contact_address
msgid "Complete Address"
msgstr "Adresse complète"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_account_invoice_partner_ids
msgid "Concerned partners"
msgstr "Contacts concernés"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_create_date
msgid "Created on"
msgstr "Créé le"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_email
msgid "Email"
msgstr "Courriel"
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_golem_legal_guardian
msgid "GOLEM Legal Guardian Management"
msgstr "GOLEM Legal Guardian Management"
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_golem_member
msgid "GOLEM Member"
msgstr "Usager"
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_golem_membership_invoice
msgid "GOLEM MemberShip invoicing"
msgstr "Facturation de l'adhésion"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_id
msgid "ID"
msgstr "ID"
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_account_invoice
msgid "Invoice"
msgstr "Facture"
#. module: golem_member_minor
#: model:ir.ui.view,arch_db:golem_member_minor.golem_member_search_inherit_minor
msgid "Is adult"
msgstr "Est adulte"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_is_default_guardian
msgid "Is default guardian"
msgstr "Par défaut"
#. module: golem_member_minor
#: model:ir.ui.view,arch_db:golem_member_minor.golem_member_search_inherit_minor
msgid "Is minor"
msgstr "Est mineur"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_account_invoice_is_minor_invoice
msgid "Is minor invoice"
msgstr "Facture sur mineur"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_member_is_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_membership_invoice_src_member_minor
msgid "Is minor?"
msgstr "Est mineur?"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_legal_guardian_id
#: model:ir.ui.view,arch_db:golem_member_minor.golem_membership_invoice_form_inherit
msgid "Legal guardian"
msgstr "Représentant légal"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_member_legal_guardian_ids
msgid "Legal guardians"
msgstr "Représentants légaux"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_member_id
msgid "Member id"
msgstr "Usager"
#. module: golem_member_minor
#: model:ir.ui.view,arch_db:golem_member_minor.golem_member_form_inherit_minor
msgid "Minor"
msgstr "Mineur"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_mobile
msgid "Mobile"
msgstr "Mobile"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_phone
msgid "Phone"
msgstr "Téléphone"
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_membership_invoice_src_member_id
msgid "Src member id"
msgstr "Usager"
#. module: golem_member_minor
#: code:addons/golem_member_minor/models/golem_legal_guardian.py:29
#: sql_constraint:golem.legal.guardian:0
#, python-format
msgid "There are doubles in your legal guardians. Please check your fills."
msgstr "Il y a des doublons au niveau des représentants légaux. Merci de vérifier vos saisies."
#. module: golem_member_minor
#: code:addons/golem_member_minor/models/golem_member.py:76
#, python-format
msgid "You must have one and only one default legal guardian. Please check your fills."
msgstr "Vous ne pouvez avoir qu'un et un seul représentant légal par défaut. Merci de vérifier vos saisies."

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-26 16:15+0000\n"
"PO-Revision-Date: 2018-08-26 16:15+0000\n"
"POT-Creation-Date: 2018-10-25 15:51+0000\n"
"PO-Revision-Date: 2018-10-25 15:51+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -25,33 +25,148 @@ msgstr ""
msgid "Can leave alone?"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_contact_address
msgid "Complete Address"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_account_invoice_partner_ids
msgid "Concerned partners"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_create_uid
msgid "Created by"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_create_date
msgid "Created on"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_display_name
msgid "Display Name"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_email
msgid "Email"
msgstr ""
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_golem_legal_guardian
msgid "GOLEM Legal Guardian Management"
msgstr ""
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_golem_member
msgid "GOLEM Member"
msgstr ""
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_golem_membership_invoice
msgid "GOLEM MemberShip invoicing"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_id
msgid "ID"
msgstr ""
#. module: golem_member_minor
#: model:ir.model,name:golem_member_minor.model_account_invoice
msgid "Invoice"
msgstr ""
#. module: golem_member_minor
#: model:ir.ui.view,arch_db:golem_member_minor.golem_member_search_inherit_minor
msgid "Is adult"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_is_default_guardian
msgid "Is default guardian"
msgstr ""
#. module: golem_member_minor
#: model:ir.ui.view,arch_db:golem_member_minor.golem_member_search_inherit_minor
msgid "Is minor"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_account_invoice_is_minor_invoice
msgid "Is minor invoice"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_member_is_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_membership_invoice_src_member_minor
msgid "Is minor?"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian___last_update
msgid "Last Modified on"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_write_uid
msgid "Last Updated by"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_write_date
msgid "Last Updated on"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_legal_guardian_id
#: model:ir.ui.view,arch_db:golem_member_minor.golem_membership_invoice_form_inherit
msgid "Legal guardian"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_member_legal_guardian_ids
msgid "Legal guardians"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_member_id
msgid "Member id"
msgstr ""
#. module: golem_member_minor
#: model:ir.ui.view,arch_db:golem_member_minor.golem_member_form_inherit_minor
msgid "Minor"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_mobile
msgid "Mobile"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_legal_guardian_phone
msgid "Phone"
msgstr ""
#. module: golem_member_minor
#: model:ir.model.fields,field_description:golem_member_minor.field_golem_membership_invoice_src_member_id
msgid "Src member id"
msgstr ""
#. module: golem_member_minor
#: code:addons/golem_member_minor/models/golem_legal_guardian.py:29
#: sql_constraint:golem.legal.guardian:0
#, python-format
msgid "There are doubles in your legal guardians. Please check your fills."
msgstr ""
#. module: golem_member_minor
#: code:addons/golem_member_minor/models/golem_member.py:76
#, python-format
msgid "You must have one and only one default legal guardian. Please check your fills."
msgstr ""

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# 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/>.
""" Post-migration script """
from openupgradelib import openupgrade
@openupgrade.migrate(use_env=False)
def migrate(cursor, version):
""" Recover old legal_gardian_ids and delete their database table """
cursor.execute('SELECT golem_member_id, res_partner_id FROM golem_member_res_partner_rel')
for member_id, legal_guardian_id in cursor.fetchall():
cursor.execute('''INSERT INTO golem_legal_guardian(member_id, legal_guardian_id) VALUES
(%s, %s)''' % (member_id, legal_guardian_id))
cursor.execute('DROP TABLE golem_member_res_partner_rel')
cursor.execute('DELETE FROM ir_model_fields WHERE name=\'legal_guardian_ids\' '
'AND ttype=\'many2many\'')

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@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
@ -15,4 +16,4 @@
# 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/>.
from . import golem_member
from . import golem_member, account_invoice, golem_legal_guardian

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@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/>.
""" Account Invoice adaptations """
from odoo import models, fields
class AccountInvoice(models.Model):
""" Account Invoice adaptations """
_inherit = 'account.invoice'
partner_ids = fields.Many2many('res.partner', string='Concerned partners',
auto_join=True)
is_minor_invoice = fields.Boolean()

View File

@ -0,0 +1,44 @@
# -*- 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 Legal Guardian Management """
from odoo import models, fields, _
class GolemLegalGuardian(models.Model):
""" GOLEM Legal Guardian Management """
_name = 'golem.legal.guardian'
_description = 'GOLEM Legal Guardian Management'
_sql_constraints = [(
'golem_legal_guardian_uniq', 'UNIQUE (member_id, legal_guardian_id)',
_('There are doubles in your legal guardians. Please check your fills.')
)]
member_id = fields.Many2one('golem.member', required=True,
index=True, auto_join=True,
ondelete='cascade')
legal_guardian_id = fields.Many2one(
'res.partner', required=True, index=True, auto_join=True,
string='Legal guardian', ondelete='cascade',
domain="[('is_company', '=', False)]"
)
contact_address = fields.Char(related='legal_guardian_id.contact_address')
phone = fields.Char(related='legal_guardian_id.phone')
mobile = fields.Char(related='legal_guardian_id.mobile')
email = fields.Char(related='legal_guardian_id.email')
is_default_guardian = fields.Boolean()

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@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
@ -18,7 +19,8 @@
""" GOLEM Member Minor management """
from datetime import date, timedelta
from odoo import models, fields, api
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
ADULT_DURATION = timedelta(days=365.25*18)
@ -26,9 +28,8 @@ class GolemMember(models.Model):
""" GOLEM Member adaptations """
_inherit = 'golem.member'
legal_guardian_ids = fields.Many2many(
'res.partner', string='Legal guardians', index=True, auto_join=True,
domain="['&', ('is_company', '=', False), ('id', '!=', partner_id)]")
legal_guardian_ids = fields.One2many('golem.legal.guardian', 'member_id',
string='Legal guardians')
activities_participation = fields.Boolean('Activities participation?')
leave_alone = fields.Boolean('Can leave alone?')
is_minor = fields.Boolean('Is minor?', compute='_compute_is_minor',
@ -52,3 +53,26 @@ class GolemMember(models.Model):
else:
operator = '<=' if value else '>'
return [('birthdate_date', operator, adult_date)]
def membership_invoice_action(self):
""" Membership invoice action for minor member """
self.ensure_one()
member = self[0]
action = self.env.ref('golem_member.golem_membership_invoice_action').read()[0]
if member.is_minor:
action['context'] = {'default_src_member_id': member.id,
'default_partner_id': False}
return action
@api.constrains('legal_guardian_ids')
def check_default_guardian(self):
""" Ensures there is one and only one default guardian, no double """
for member in self:
if len(member.legal_guardian_ids):
default_guardians_count = len(member.legal_guardian_ids.filtered(
'is_default_guardian'
))
if not default_guardians_count or default_guardians_count > 1:
verr = _('You must have one and only one default legal '
'guardian. Please check your fills.')
raise ValidationError(verr)

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright 2017-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/>.
""" Res Partner adaptations """
from odoo import models, fields
class ResPartner(models.Model):
""" Res Partner adaptations """
_inherit = 'res.partner'
is_default_gardian = fields.Boolean()
def do_default_gardian(self):
""" make only default gardian """
self.ensure_one()
self.is_default_gardian = True
member_id = self._context.get('member_id', False)

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_legal_guardian_user,Access GOLEM Legal Guardian User,model_golem_legal_guardian,golem_base.group_golem_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_legal_guardian_user Access GOLEM Legal Guardian User model_golem_legal_guardian golem_base.group_golem_user 1 1 1 1

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
Copyright 2018 Youssef El Ouahby <youssef@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/>.
-->
<odoo>
<data>
<!-- Forms -->
<record id="account.invoice_form_inherited_member_minor" model="ir.ui.view">
<field name="name">account.invoice.form.iherited.member.minor</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<field name='partner_id' position='after'>
<field name='is_minor_invoice' invisible="1" />
<field name="partner_ids" widget="many2many_tags" readonly="1"
attrs="{'invisible': [('is_minor_invoice', '=', False)]}" />
</field>
</field>
</record>
</data>
</odoo>

View File

@ -2,6 +2,7 @@
<!--
Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
Copyright 2018 Youssef El Ouahby <youssef@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
@ -20,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<odoo>
<data>
<!-- Form -->
<!-- Forms -->
<record model="ir.ui.view" id="golem_member_form_inherit_minor">
<field name="name">Add Minor Page/Tab</field>
<field name="model">golem.member</field>
@ -34,19 +35,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="leave_alone"/>
<field name="partner_id" invisible="True" required="False" />
<field name="is_minor" invisible="True" />
<field name="legal_guardian_ids"
context="{'search_default_type_person': 1}">
<tree>
<field name="name" />
<field name="contact_address" />
<field name="phone" />
<field name="mobile" />
<field name="email" widget="email" />
</tree>
</field>
<field name="legal_guardian_ids" context="{'default_member_id': active_id}" />
</group>
</page>
</page>
<xpath expr="//page[@name='membership']/group/group/div/button[1]"
position="attributes">
<attribute name="name">membership_invoice_action</attribute>
<attribute name="type">object</attribute>
</xpath>
</field>
</record>
<record id="golem_legal_guardian_view_form" model="ir.ui.view">
<field name="name">GOLEM Legal Guardian Form</field>
<field name="model">golem.legal.guardian</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="member_id" />
<field name="legal_guardian_id" />
<field name="is_default_guardian" />
</group>
</sheet>
</form>
</field>
</record>
<!-- Trees -->
<record id="golem_legal_guardian_view_tree" model="ir.ui.view">
<field name="name">GOLEM Legal Guardian Tree</field>
<field name="model">golem.legal.guardian</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="legal_guardian_id" />
<field name="contact_address" />
<field name="phone" attrs="{'readonly': [('legal_guardian_id', '=', False)]}" />
<field name="mobile" attrs="{'readonly': [('legal_guardian_id', '=', False)]}" />
<field name="email" widget="email" attrs="{'readonly': [('legal_guardian_id', '=', False)]}" />
<field name="is_default_guardian" />
</tree>
</field>
</record>

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# 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/>.
from . import golem_membership_invoice

View File

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@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 Membership """
from odoo import models, fields, api
class GolemMembershipInvoice(models.TransientModel):
""" Membership invoicing """
_inherit = 'golem.membership.invoice'
src_member_id = fields.Many2one('golem.member', ondelete='cascade')
src_member_minor = fields.Boolean(related='src_member_id.is_minor')
@api.onchange('src_member_id')
def onchange_member(self):
""" Set partner domain if src_member_id is filled """
self.ensure_one()
record = self[0]
domain = ([('id', 'in',
record.src_member_id.mapped('legal_guardian_ids.legal_guardian_id').ids)]
if record.src_member_id.is_minor else [])
return {'domain': {'partner_id': domain}}
@api.multi
def membership_invoice(self):
""" Add partners concerned to invoice and move membership from legal
guardian to minor """
self.ensure_one()
record = self[0]
res = super(GolemMembershipInvoice, self).membership_invoice()
if record.src_member_id.is_minor:
# Getting invoice IDS from action's domain already declared
invoice_ids = (res['domain'][0][2] or False)
if invoice_ids: # As invoice_ids is a Python list, empty or not
invoice = self.env['account.invoice'].browse(invoice_ids)[-1]
invoice.is_minor_invoice = True
invoice.partner_ids = [(6, 0, [record.partner_id.id,
record.src_member_id.partner_id.id])]
# move the created membership from legal guardian to the minor
membership_line = record.partner_id.member_lines[0]
membership_line.copy({'partner': record.src_member_id.partner_id.id})
membership_line.unlink()
return res

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
Copyright 2018 Youssef El Ouahby <youssef@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/>.
-->
<odoo>
<data>
<!-- Forms -->
<record id="golem_membership_invoice_form_inherit" model="ir.ui.view">
<field name="name">membership.invoice.view.form_iherit</field>
<field name="model">golem.membership.invoice</field>
<field name="inherit_id" ref="golem_membership.golem_membership_invoice_form" />
<field name="arch" type="xml">
<field name='product_id' position='before'>
<field name='src_member_id' invisible="1" />
<field name='src_member_minor' invisible="1" />
<field name='partner_id' string="Legal guardian"
options="{'no_create': True}"
attrs="{'invisible': [('src_member_id', '=', False)], 'required': [('src_member_minor', '=', True)]}" />
</field>
</field>
</record>
</data>
</odoo>

View File

@ -26,7 +26,8 @@ class GolemMembershipInvoice(models.TransientModel):
_name = 'golem.membership.invoice'
_description = 'GOLEM MemberShip invoicing'
partner_id = fields.Many2one('res.partner', 'Partner')
partner_id = fields.Many2one('res.partner', 'Partner', required=True,
ondelete='cascade')
product_id = fields.Many2one('product.product', 'Membership',
required=True)
member_price = fields.Float('Member Price',