Skip to content

Commit

Permalink
[ADD][REF]GOLEM Member and Family Histories enhancements
Browse files Browse the repository at this point in the history
* Small refactorings ;
* Add zip code history handling ;
* Add translations and base security.
  • Loading branch information
Yakulu committed Oct 26, 2018
1 parent e3d2c63 commit 2599eb5
Show file tree
Hide file tree
Showing 14 changed files with 587 additions and 56 deletions.
4 changes: 2 additions & 2 deletions golem_family_history/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
'name': 'GOLEM Families History',
'summary': 'GOLEM Families History',
'description': 'GOLEM Families History',
'version': '10.0.0.0.1',
'version': '10.0.0.1.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El ouahby',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': ['golem_family'],
'data': ['views/golem_family_views.xml']
'data': ['security/ir.model.access.csv', 'views/golem_family_views.xml']
}
109 changes: 109 additions & 0 deletions golem_family_history/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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 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_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"

109 changes: 109 additions & 0 deletions golem_family_history/i18n/golem_family_history.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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 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_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 member 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 ""

35 changes: 17 additions & 18 deletions golem_family_history/models/golem_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,33 @@

""" GOLEM Families Adaptations"""

from odoo import models, fields, api, _
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')
family_history_ids = fields.One2many('golem.family.history', 'family_id',
readonly=True, string='History details')

@api.constrains('city', 'country_id', 'member_ids')
@api.constrains('zip', 'city', 'country_id', 'member_ids')
def save_family_history(self):
""" save family history """
""" Saves family history """
default_season = self.env['golem.season'].search([('is_default', '=', True)], limit=1)
for family in self:
history = self.env['golem.family.history'].search([
history_id = self.env['golem.family.history'].search([
('family_id', '=', family.id),
('season_id', '=', default_season.id)], limit=1)
if history:
history.write({
'city': family.city,
'country_id': family.country_id.id,
'member_ids':[(6, False, family.member_ids.ids)]
})
history_data = {
'zip_code': family.zip,
'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:
self.env['golem.family.history'].create({
'family_id': family.id,
'season_id': default_season.id,
'city': family.city,
'country_id': family.country_id.id,
'member_ids':[(6, False, family.member_ids.ids)]
})
history_data.update({'family_id': family.id,
'season_id': default_season.id})
self.env['golem.family.history'].create(history_data)
16 changes: 11 additions & 5 deletions golem_family_history/models/golem_family_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@

""" GOLEM Family History Management """

from odoo import models, fields, api, _
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"
_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,
ondelete="cascade")
string='Family', ondelete='cascade')
season_id = fields.Many2one('golem.season', required=True, auto_join=True,
ondelete="cascade")
string='Season', ondelete='cascade')
zip_code = fields.Char(string='ZIP')
city = fields.Char()
country_id = fields.Many2one('res.country', string='Country')
member_ids = fields.Many2many('res.partner')
member_ids = fields.Many2many('res.partner', string='Members',
auto_join=True)
2 changes: 2 additions & 0 deletions golem_family_history/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions golem_family_history/views/golem_family_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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>
Expand All @@ -32,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<tree>
<field name="season_id"/>
<field name="member_ids"/>
<field name="zip_code"/>
<field name="city"/>
<field name="country_id"/>
</tree>
Expand All @@ -40,5 +42,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</page>
</field>
</record>

</data>
</odoo>
4 changes: 2 additions & 2 deletions golem_member_history/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
{
'name': 'GOLEM Member History',
'summary': 'Member History',
'version': '10.0.0.0.1',
'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': ['views/golem_member_views.xml']
'data': ['security/ir.model.access.csv', 'views/golem_member_views.xml']
}
Loading

0 comments on commit 2599eb5

Please sign in to comment.