Merge branch 'master' into data_history

This commit is contained in:
Fabien BOURGEOIS 2018-10-25 18:30:20 +02:00
commit e3d2c63402
38 changed files with 930 additions and 105 deletions

View File

@ -20,11 +20,11 @@
'summary': 'GOLEM Activity Registration Custom Price',
'description': '''GOLEM Activity Registration Custom Price :
- allow set of 1:n slices based on family quotient ;
- allow set 1:n area data ;
- allow set 1:n root area data ;
- allow set price per area and slice ;
- computes automatically applicable price ;
- anticipate ruleset to be implemented for computing.''',
'version': '10.0.0.1.2',
'version': '10.0.0.2.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -1,6 +1,7 @@
# -*- 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
@ -43,7 +44,7 @@ class GolemActivity(models.Model):
existing_combinations = [u'%s-%s' % (line.area_id.id, line.slice_id.id)
for line in activity.price_line_ids]
slice_ids = self.env['golem.payment.rule.familyquotient.slice'].search([])
for area_id in self.env['golem.partner.area'].search([]):
for area_id in self.env['golem.partner.area'].search([('parent_id', '=', False)]):
for slice_id in slice_ids:
combination = u'%s-%s' % (area_id.id, slice_id.id)
if combination not in existing_combinations:

View File

@ -1,6 +1,7 @@
# -*- 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
@ -40,7 +41,7 @@ class GolemMember(models.Model):
area_ids = self.env['golem.partner.area'].search([])
if member.area_id:
applicable_areas += area_ids.filtered(
lambda r: r == member.area_id
lambda r: r == member.area_id.root_id
)
if not applicable_areas and area_ids:
applicable_areas += area_ids[0]

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
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
})
#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,9 +19,9 @@
'name': 'GOLEM families',
'summary': 'GOLEM Members Families',
'description': 'GOLEM Members Families',
'version': '10.0.2.3.1',
'version': '10.0.2.4.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'author': 'Fabien Bourgeois, Youssef El Ouahby',
'license': 'AGPL-3',
'application': False,
'installable': True,

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-01 10:12+0000\n"
"PO-Revision-Date: 2018-08-01 12:15+0200\n"
"POT-Creation-Date: 2018-10-19 07:03+0000\n"
"PO-Revision-Date: 2018-10-19 09:04+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -145,8 +145,8 @@ msgid "Family"
msgstr "Famille"
#. module: golem_family
#: code:addons/golem_family/models/golem_family.py:50
#: code:addons/golem_family/models/golem_family.py:84
#: code:addons/golem_family/models/golem_family.py:49
#: code:addons/golem_family/models/golem_family.py:83
#, python-format
msgid "Family Members"
msgstr "Membres de la famille"
@ -308,6 +308,16 @@ msgstr "Role"
msgid "Roles"
msgstr "Roles"
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_single_parent
msgid "Single parent"
msgstr "Monoparentale"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_search
msgid "Single-parent"
msgstr "Monoparentale"
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_state_id
#: model:ir.model.fields,field_description:golem_family.field_golem_member_family_state_id
@ -388,3 +398,4 @@ msgstr "membres"
#: model:ir.ui.view,arch_db:golem_family.golem_member_form_inherit_golem_family
msgid "name@example.org"
msgstr "name@example.org"

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-01 10:12+0000\n"
"PO-Revision-Date: 2018-08-01 10:12+0000\n"
"POT-Creation-Date: 2018-10-19 07:03+0000\n"
"PO-Revision-Date: 2018-10-19 07:03+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -145,8 +145,8 @@ msgid "Family"
msgstr ""
#. module: golem_family
#: code:addons/golem_family/models/golem_family.py:50
#: code:addons/golem_family/models/golem_family.py:84
#: code:addons/golem_family/models/golem_family.py:49
#: code:addons/golem_family/models/golem_family.py:83
#, python-format
msgid "Family Members"
msgstr ""
@ -308,6 +308,16 @@ msgstr ""
msgid "Roles"
msgstr ""
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_single_parent
msgid "Single parent"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_search
msgid "Single-parent"
msgstr ""
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_state_id
#: model:ir.model.fields,field_description:golem_family.field_golem_member_family_state_id

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
# 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
@ -140,6 +141,7 @@ class GolemFamily(models.Model):
member_ids = fields.One2many('res.partner', 'family_id', 'Members',
domain=[('is_company', '=', False)])
single_parent = fields.Boolean()
note = fields.Text()
count = fields.Integer(compute='_compute_count', store=True)

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
@ -36,6 +37,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</h1>
</div>
</group>
<group>
<field name="single_parent" />
</group>
<group string="Address">
<group>
<field name="street" placeholder="Street..." />
@ -187,6 +191,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="phone" />
<field name="mobile" />
<field name="email" />
<filter name="single_parent" string="Single-parent"
domain="[('single_parent', '=', True)]" />
<group string="Group By">
<filter name="group_city" string="By city"
context="{'group_by': 'city'}"/>

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

@ -20,7 +20,7 @@
'name': 'GOLEM non-profit members',
'summary': 'Extends Odoo contacts for MJC',
'description': 'Extends Odoo contacts for MJC',
'version': '10.0.2.3.5',
'version': '10.0.2.4.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne',
'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-08-27 09:04+0000\n"
"PO-Revision-Date: 2018-08-27 11:21+0200\n"
"POT-Creation-Date: 2018-10-22 16:02+0000\n"
"PO-Revision-Date: 2018-10-22 18:09+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -72,6 +72,18 @@ msgstr "Appliquer pour les nouveaux adhérents"
msgid "Area"
msgstr "Territoire"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_partner_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_users_area_from_street
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
@ -295,6 +307,7 @@ msgstr "Faire de ce contact un usager"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_uid
msgid "Created by"
msgstr "Créé par"
@ -303,6 +316,7 @@ msgstr "Créé par"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_date
msgid "Created on"
msgstr "Créé le"
@ -381,6 +395,7 @@ msgstr "Département"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_display_name
msgid "Display Name"
msgstr "Nom affiché"
@ -415,7 +430,7 @@ msgid "Fax"
msgstr "Fax"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Female"
msgstr "Féminin"
@ -487,11 +502,16 @@ msgid "GOLEM Members Tags"
msgstr "Catégories d'adhérents"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:360
#: code:addons/golem_member/models/golem_member.py:433
#, python-format
msgid "GOLEM Members merge has not been implemented yet. Please only merge partners, not members, or delete GOLEM Members manually before merging."
msgstr "La fusion d'adhérents n'a pas encore été implémentée. Merci de ne fusionner que des contacts non adhérents, ou bien de supprimer les adhérents manuellement en premier lieu."
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_partner_area_street
msgid "GOLEM Partner Area Street"
msgstr "GOLEM Partner Area Street"
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_season
msgid "GOLEM Season"
@ -537,6 +557,7 @@ msgstr "A des écritures non lettrées"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_id
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_id
msgid "ID"
msgstr "ID"
@ -677,6 +698,7 @@ msgstr "Langue"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"
@ -684,6 +706,7 @@ msgstr "Dernière Modification le"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
@ -692,6 +715,7 @@ msgstr "Dernière mise à jour par"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
@ -712,7 +736,7 @@ msgid "Latest Invoices & Payments Matching Date"
msgstr "Date de dernière correspondance des factures et paiements"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Male"
msgstr "Masculin"
@ -740,7 +764,7 @@ msgstr "Image de taille moyenne de ce contact. Elle est automatiquement redimens
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_member_id
msgid "Member"
msgstr "Adhérent"
msgstr "Usager"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name
@ -804,8 +828,9 @@ msgstr "NIC"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4301
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4230
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_name
msgid "Name"
msgstr "Nom"
@ -817,8 +842,8 @@ msgid "Nationality"
msgstr "Nationalité"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format
@ -865,6 +890,16 @@ msgstr "Refuse les SMS ?"
msgid "Out of mailings?"
msgstr "Refuse la réception de mails ?"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Parent"
msgstr "Parent"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_parent_id
msgid "Parent Territory"
msgstr "Territoire parent"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_parent_name
msgid "Parent name"
@ -949,6 +984,16 @@ msgstr "Date d'inscription"
msgid "Related Company"
msgstr "Société liée"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Root Territories"
msgstr "Territoires racines"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_root_id
msgid "Root area"
msgstr "Territoire racine"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_siren
msgid "SIREN"
@ -1084,6 +1129,11 @@ msgstr "État"
msgid "Street"
msgstr "Rue"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_area_street_ids
msgid "Street list"
msgstr "Liste de rues"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
msgid "Street..."
@ -1092,7 +1142,12 @@ msgstr "Rue..."
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_street2
msgid "Street2"
msgstr "Complément de rue"
msgstr "Rue 2"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Sub Territories"
msgstr "Sous-territoires"
#. module: golem_member
#: model:ir.actions.act_window,name:golem_member.golem_member_action
@ -1150,6 +1205,12 @@ msgstr "L'utilisateur interne qui est en charge de la communication avec ce cont
msgid "The name of official registry where this company was declared."
msgstr "Nom de la ville du tribunal de commerce dans laquelle la société est enregistrée."
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:69
#, python-format
msgid "The parent area is a sub area of the current area, please change it."
msgstr "Le territoire parent est un sous-territoire du territoire courant, merci de modifier vos saisies."
#. module: golem_member
#: model:ir.model.fields,help:golem_member.field_golem_member_has_unreconciled_entries
msgid "The partner has at least one unreconciled debit and credit since last time the invoices & payments matching was performed."
@ -1186,14 +1247,14 @@ msgid "This field holds the image used as avatar for this contact, limited to 10
msgstr "Ce champ contient l'image utilisée comme photo d'identité pour ce contact, limitée à 1024x1024px."
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:108
#: code:addons/golem_member/models/golem_member.py:168
#: sql_constraint:golem.member:0
#, python-format
msgid "This member number has already been used."
msgstr "Ce numéro d'adhérent a été déjà utilisé."
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:33
#: code:addons/golem_member/models/golem_member.py:47
#: sql_constraint:golem.partner.area:0
#, python-format
msgid "This patner area has already been used."
@ -1260,7 +1321,7 @@ msgid "Total amount you have to pay to this vendor."
msgstr "Montant total à payer au fournisseur."
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:175
#: code:addons/golem_member/models/golem_member.py:235
#, python-format
msgid "Unsupported operator for defautl season search"
msgstr "Opérateur de recherche non supporté pour le filtre de saison par défaut"
@ -1296,8 +1357,8 @@ msgid "Website of Partner or Company"
msgstr "Site Web pour les Partenaires ou les Sociétés"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format

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-27 09:04+0000\n"
"PO-Revision-Date: 2018-08-27 09:04+0000\n"
"POT-Creation-Date: 2018-10-22 16:02+0000\n"
"PO-Revision-Date: 2018-10-22 16:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -72,6 +72,18 @@ msgstr ""
msgid "Area"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_partner_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_users_area_from_street
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
@ -295,6 +307,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_uid
msgid "Created by"
msgstr ""
@ -303,6 +316,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_date
msgid "Created on"
msgstr ""
@ -381,6 +395,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_display_name
msgid "Display Name"
msgstr ""
@ -415,7 +430,7 @@ msgid "Fax"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Female"
msgstr ""
@ -487,11 +502,16 @@ msgid "GOLEM Members Tags"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:360
#: code:addons/golem_member/models/golem_member.py:433
#, python-format
msgid "GOLEM Members merge has not been implemented yet. Please only merge partners, not members, or delete GOLEM Members manually before merging."
msgstr ""
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_partner_area_street
msgid "GOLEM Partner Area Street"
msgstr ""
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_season
msgid "GOLEM Season"
@ -537,6 +557,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_id
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_id
msgid "ID"
msgstr ""
@ -671,6 +692,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street___last_update
msgid "Last Modified on"
msgstr ""
@ -678,6 +700,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_uid
msgid "Last Updated by"
msgstr ""
@ -686,6 +709,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_date
msgid "Last Updated on"
msgstr ""
@ -706,7 +730,7 @@ msgid "Latest Invoices & Payments Matching Date"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Male"
msgstr ""
@ -798,8 +822,9 @@ msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4301
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4230
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_name
msgid "Name"
msgstr ""
@ -811,8 +836,8 @@ msgid "Nationality"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format
@ -859,6 +884,16 @@ msgstr ""
msgid "Out of mailings?"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Parent"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_parent_id
msgid "Parent Territory"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_parent_name
msgid "Parent name"
@ -941,6 +976,16 @@ msgstr ""
msgid "Related Company"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Root Territories"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_root_id
msgid "Root area"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_siren
msgid "SIREN"
@ -1076,6 +1121,11 @@ msgstr ""
msgid "Street"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_area_street_ids
msgid "Street list"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
msgid "Street..."
@ -1086,6 +1136,11 @@ msgstr ""
msgid "Street2"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Sub Territories"
msgstr ""
#. module: golem_member
#: model:ir.actions.act_window,name:golem_member.golem_member_action
#: model:ir.ui.menu,name:golem_member.golem_members_menu
@ -1142,6 +1197,12 @@ msgstr ""
msgid "The name of official registry where this company was declared."
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:69
#, python-format
msgid "The parent area is a sub area of the current area, please change it."
msgstr ""
#. module: golem_member
#: model:ir.model.fields,help:golem_member.field_golem_member_has_unreconciled_entries
msgid "The partner has at least one unreconciled debit and credit since last time the invoices & payments matching was performed."
@ -1178,14 +1239,14 @@ msgid "This field holds the image used as avatar for this contact, limited to 10
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:108
#: code:addons/golem_member/models/golem_member.py:168
#: sql_constraint:golem.member:0
#, python-format
msgid "This member number has already been used."
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:33
#: code:addons/golem_member/models/golem_member.py:47
#: sql_constraint:golem.partner.area:0
#, python-format
msgid "This patner area has already been used."
@ -1252,7 +1313,7 @@ msgid "Total amount you have to pay to this vendor."
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:175
#: code:addons/golem_member/models/golem_member.py:235
#, python-format
msgid "Unsupported operator for defautl season search"
msgstr ""
@ -1288,8 +1349,8 @@ msgid "Website of Partner or Company"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright 2016-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
@ -19,9 +20,22 @@
import logging
from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.exceptions import UserError, ValidationError
_LOGGER = logging.getLogger(__name__)
def get_root_area(area_id):
""" Get root area """
if not area_id.parent_id:
return area_id
return get_root_area(area_id.parent_id)
def is_sub_area(area_id, parent_id):
""" Check if parent is sub area """
if parent_id.parent_id.id == area_id.id:
return True
if not parent_id.parent_id:
return False
return is_sub_area(area_id, parent_id.parent_id)
class PartnerArea(models.Model):
""" Partner Area """
@ -34,6 +48,37 @@ class PartnerArea(models.Model):
name = fields.Char(required=True, index=True)
sequence = fields.Integer()
area_street_ids = fields.One2many('golem.partner.area.street', 'area_id',
string='Street list')
parent_id = fields.Many2one('golem.partner.area', string='Parent Territory',
domain="[('id', '!=', id)]")
root_id = fields.Many2one('golem.partner.area', compute='_compute_root_id',
string='Root area')
@api.depends('parent_id')
def _compute_root_id(self):
""" Compute root_id """
for area in self:
area.root_id = get_root_area(area)
@api.constrains('parent_id')
def check_parent_id(self):
""" Check if parent is sub area """
for area in self:
if is_sub_area(area, area.parent_id):
err = _('The parent area is a sub area of the current area, '
'please change it.')
raise ValidationError(err)
class GolemPartnerAreaStreet(models.Model):
""" GOLEM Partner Area Street Management """
_name = 'golem.partner.area.street'
_description = 'GOLEM Partner Area Street'
name = fields.Char(required=True)
area_id = fields.Many2one('golem.partner.area', required=True, sring='Area',
index=True, auto_join=True, ondelete='set null')
class ResPartner(models.Model):
@ -51,6 +96,7 @@ class ResPartner(models.Model):
'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)
country_id = fields.Many2one(default=_get_default_nationality_id)
# Gender overwriting : no need for 'other' choice
@ -83,6 +129,20 @@ class ResPartner(models.Model):
gm_obj = self.env['golem.member']
gm_obj.create({'partner_id': self[0].id})
@api.constrains('street')
def save_street(self):
""" Save street if no exist """
for member in self:
if member.street and not member.area_from_street:
mstreet = member.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': member.area_id.id}
)
class GolemMembershipInvoice(models.TransientModel):
""" GOLEM Membership Invoice adaptations """
_inherit = 'golem.membership.invoice'
@ -182,6 +242,19 @@ class GolemMember(models.Model):
is_num_man = (conf.get_param('golem_numberconfig_isautomatic') == '0')
self.update({'is_number_manual': is_num_man})
@api.onchange('street')
def onchange_street(self):
""" Area auto assignement """
for member in self:
mstreet = member.street.strip() if member.street else False
if mstreet and not member.area_id:
street_id = self.env['golem.partner.area.street'].search(
[('name', 'ilike', mstreet)], limit=1
)
if street_id:
member.area_id = street_id.area_id
member.area_from_street = True
@api.multi
def generate_number_perseason(self):
""" Number generation in case of per season configuration """
@ -250,10 +323,10 @@ class GolemMember(models.Model):
member.number = member.generate_number_global()
@api.multi
def write(self, values):
def write(self, vals):
""" Number generation after updates """
res = super(GolemMember, self).write(values)
if 'season_ids' in values or 'number_manual' in values:
res = super(GolemMember, self).write(vals)
if 'season_ids' in vals or 'number_manual' in vals:
self.generate_number()
return res

View File

@ -1,5 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_member_user,Access GOLEM Member User,model_golem_member,golem_base.group_golem_user,1,1,1,1
access_partner_area_user,Access GOLEM Partner Area User,model_golem_partner_area,golem_base.group_golem_user,1,1,1,1
access_partner_area_street_user,Access GOLEM Partner Area Street User,model_golem_partner_area_street,golem_base.group_golem_user,1,1,1,1
access_golem_member_season_user,Access GOLEM Member Season User,model_golem_member_number,golem_base.group_golem_user,1,1,1,1
access_ir_config_parameter_manager,Access IR Config Parameter Manager,base.model_ir_config_parameter,golem_base.group_golem_manager,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_user Access GOLEM Member User model_golem_member golem_base.group_golem_user 1 1 1 1
3 access_partner_area_user Access GOLEM Partner Area User model_golem_partner_area golem_base.group_golem_user 1 1 1 1
4 access_partner_area_street_user Access GOLEM Partner Area Street User model_golem_partner_area_street golem_base.group_golem_user 1 1 1 1
5 access_golem_member_season_user Access GOLEM Member Season User model_golem_member_number golem_base.group_golem_user 1 1 1 1
6 access_ir_config_parameter_manager Access IR Config Parameter Manager base.model_ir_config_parameter golem_base.group_golem_manager 1 1 1 1

View File

@ -1,6 +1,7 @@
<?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
@ -24,13 +25,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="name">GOLEM Partner Area Tree</field>
<field name="model">golem.partner.area</field>
<field name="arch" type="xml">
<tree editable="bottom">
<tree>
<field name="sequence" widget="handle" />
<field name="name" />
<field name="parent_id"/>
</tree>
</field>
</record>
<!-- Form -->
<record model="ir.ui.view" id="golem_partner_area_view_form">
<field name="name">GOLEM Partner Area Form</field>
<field name="model">golem.partner.area</field>
<field name="arch" type="xml">
<form>
<group>
<group>
<field name="name" />
</group>
<group>
<field name="parent_id" />
<field name="root_id" />
</group>
</group>
<group>
<field name="area_street_ids">
<tree editable="bottom">
<field name="name" />
</tree>
</field>
</group>
</form>
</field>
</record>
<!-- Search -->
<record id="golem_partner_area_view_search" model="ir.ui.view">
<field name="name">GOLEM Partner Area Search</field>
@ -38,13 +66,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="arch" type="xml">
<search>
<field name="name" />
<field name="parent_id" />
<filter name="sub_territories" string="Sub Territories"
domain="[('parent_id', '!=', False)]" />
<filter name="root_territories" string="Root Territories"
domain="[('parent_id', '=', False)]" />
<filter name="group_parent" string="Parent"
context="{'group_by': 'parent_id'}" />
</search>
</field>
</record>
<!-- Actions -->
<act_window id="golem_partner_area_action"
name="Areas" res_model="golem.partner.area" view_mode="tree" />
<act_window id="golem_partner_area_action" name="Areas"
res_model="golem.partner.area" view_mode="tree,form" />
<!-- Menus -->
<menuitem id="golem_partner_area_menu" name="Areas"

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

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@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 +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/>.
""" 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 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',