[MIG][IMP]GOLEM Season migration to v10, and better guidelines

This commit is contained in:
Fabien BOURGEOIS 2017-05-01 16:27:16 +02:00
parent 8efabe7ec8
commit 48c081d16f
5 changed files with 84 additions and 73 deletions

View File

@ -23,7 +23,7 @@
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',
'application': False, 'application': False,
'installable': False, 'installable': True,
'depends': ['golem_base'], 'depends': ['golem_base'],
'data': ['security/ir.model.access.csv', 'views/golem_season_view.xml'] 'data': ['security/ir.model.access.csv', 'views/golem_season_views.xml']
} }

View File

@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-13 15:46+0000\n" "POT-Creation-Date: 2017-05-01 14:19+0000\n"
"PO-Revision-Date: 2016-07-13 15:46+0000\n" "PO-Revision-Date: 2017-05-01 14:19+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -17,48 +17,53 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: golem_season #. module: golem_season
#: field:golem.season,member_counter:0 #: sql_constraint:golem.season:0
msgid "Ce nom pour la saison a déjà été utilisé. Merci d'en choisir un autre."
msgstr "Ce nom pour la saison a déjà été utilisé. Merci d'en choisir un autre."
#. module: golem_season
#: model:ir.model.fields,field_description:golem_season.field_golem_season_member_counter
msgid "Counter for member number generation" msgid "Counter for member number generation"
msgstr "Compteur pour la génération des numéros d'adhérents" msgstr "Compteur pour la génération des numéros d'adhérents"
#. module: golem_season #. module: golem_season
#: field:golem.season,create_uid:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_create_uid
msgid "Created by" msgid "Created by"
msgstr "Créé par" msgstr "Créé par"
#. module: golem_season #. module: golem_season
#: field:golem.season,create_date:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_create_date
msgid "Created on" msgid "Created on"
msgstr "Créé le" msgstr "Créé le"
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:53 #: code:addons/golem_season/models/golem_season.py:56
#, python-format #, python-format
msgid "Current period cannot be included into another existing period." msgid "Current period cannot be included into another existing period."
msgstr "La période actuelle est en conflit avec une période existante." msgstr "La période actuelle est en conflit avec une période existante."
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.filter #: model:ir.ui.view,arch_db:golem_season.filter
msgid "Default season" msgid "Default season"
msgstr "Saison par défaut" msgstr "Saison par défaut"
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.form #: model:ir.ui.view,arch_db:golem_season.golem_season_view_form
msgid "Default season for views ?" msgid "Default season for views ?"
msgstr "Saison affichée par défaut dans toutes les listes ?" msgstr "Saison affichée par défaut dans toutes les listes ?"
#. module: golem_season #. module: golem_season
#: field:golem.season,is_default:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_is_default
msgid "Default season for views?" msgid "Default season for views?"
msgstr "Saison affichée par défaut partout?" msgstr "Saison affichée par défaut partout?"
#. module: golem_season #. module: golem_season
#: field:golem.season,display_name:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_display_name
msgid "Display Name" msgid "Display Name"
msgstr "Nom affiché" msgstr "Nom affiché"
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:51 #: code:addons/golem_season/models/golem_season.py:52
#, python-format #, python-format
msgid "End of the period is in range of an existing period." msgid "End of the period is in range of an existing period."
msgstr "La fin de la période est en conflit avec une période existante." msgstr "La fin de la période est en conflit avec une période existante."
@ -69,77 +74,76 @@ msgid "GOLEM Season"
msgstr "Saison" msgstr "Saison"
#. module: golem_season #. module: golem_season
#: model:ir.actions.act_window,name:golem_season.action_list #: model:ir.actions.act_window,name:golem_season.golem_season_action
#: model:ir.ui.menu,name:golem_season.menu_seasons #: model:ir.ui.menu,name:golem_season.golem_season_menu
msgid "GOLEM Seasons" msgid "GOLEM Seasons"
msgstr "Saisons" msgstr "Saisons"
#. module: golem_season #. module: golem_season
#: field:golem.season,id:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_id
msgid "ID" msgid "ID"
msgstr "ID" msgstr "ID"
#. module: golem_season #. module: golem_season
#: field:golem.season,__last_update:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season___last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "Dernière modification le" msgstr "Dernière modification le"
#. module: golem_season #. module: golem_season
#: field:golem.season,write_uid:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "Dernière modification par" msgstr "Dernière modification par"
#. module: golem_season #. module: golem_season
#: field:golem.season,write_date:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "Dernière modification le" msgstr "Dernière modification le"
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.form #: model:ir.ui.view,arch_db:golem_season.golem_season_view_form
msgid "Make this season as default" msgid "Make this season as default"
msgstr "Activer cette saison par défaut" msgstr "Activer cette saison par défaut"
#. module: golem_season #. module: golem_season
#: field:golem.season,date_end:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_date_end
msgid "Period end" msgid "Period end"
msgstr "Fin de la période" msgstr "Fin de la période"
#. module: golem_season #. module: golem_season
#: field:golem.season,date_start:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_date_start
msgid "Period start" msgid "Period start"
msgstr "Début de la période" msgstr "Début de la période"
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.form #: model:ir.ui.view,arch_db:golem_season.golem_season_view_form
msgid "Season" msgid "Season"
msgstr "Saison" msgstr "Saison"
#. module: golem_season #. module: golem_season
#: field:golem.season,name:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_name
msgid "Season name" msgid "Season name"
msgstr "Nom de la saison" msgstr "Nom de la saison"
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:41 #: code:addons/golem_season/models/golem_season.py:42
#, python-format #, python-format
msgid "Start of the period cannot be after end of the period." msgid "Start of the period cannot be after end of the period."
msgstr "Le début de la période ne peut être postérieur à sa fin." msgstr "Le début de la période ne peut être postérieur à sa fin."
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:47 #: code:addons/golem_season/models/golem_season.py:48
#, python-format #, python-format
msgid "Start of the period is in range of an existing period." msgid "Start of the period is in range of an existing period."
msgstr "Le début de la période est en conflit avec une période existante." msgstr "Le début de la période est en conflit avec une période existante."
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:27 #: code:addons/golem_season/models/golem_season.py:28
#: sql_constraint:golem.season:0
#, python-format #, python-format
msgid "This season name has already been used." msgid "This season name has already been used."
msgstr "Ce nom pour la saison a déjà été utilisé. Merci d'en choisir un autre." msgstr "Ce nom pour la saison a déjà été utilisé. Merci d'en choisir un autre."
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:89 #: code:addons/golem_season/models/golem_season.py:92
#, python-format #, python-format
msgid "You can't delete the default season" msgid "You can't delete the default season"
msgstr "Vous ne pouvez pas supprimer la saison par défaut" msgstr "Vous ne pouvez pas supprimer la saison par défaut"

View File

@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-13 15:46+0000\n" "POT-Creation-Date: 2017-05-01 14:18+0000\n"
"PO-Revision-Date: 2016-07-13 15:46+0000\n" "PO-Revision-Date: 2017-05-01 14:18+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,48 +16,53 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: golem_season #. module: golem_season
#: field:golem.season,member_counter:0 #: sql_constraint:golem.season:0
msgid "Ce nom pour la saison a déjà été utilisé. Merci d'en choisir un autre."
msgstr ""
#. module: golem_season
#: model:ir.model.fields,field_description:golem_season.field_golem_season_member_counter
msgid "Counter for member number generation" msgid "Counter for member number generation"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,create_uid:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_create_uid
msgid "Created by" msgid "Created by"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,create_date:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_create_date
msgid "Created on" msgid "Created on"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:55 #: code:addons/golem_season/models/golem_season.py:56
#, python-format #, python-format
msgid "Current period cannot be included into another existing period." msgid "Current period cannot be included into another existing period."
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.filter #: model:ir.ui.view,arch_db:golem_season.filter
msgid "Default season" msgid "Default season"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.form #: model:ir.ui.view,arch_db:golem_season.golem_season_view_form
msgid "Default season for views ?" msgid "Default season for views ?"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,is_default:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_is_default
msgid "Default season for views?" msgid "Default season for views?"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,display_name:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:51 #: code:addons/golem_season/models/golem_season.py:52
#, python-format #, python-format
msgid "End of the period is in range of an existing period." msgid "End of the period is in range of an existing period."
msgstr "" msgstr ""
@ -68,77 +73,76 @@ msgid "GOLEM Season"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: model:ir.actions.act_window,name:golem_season.action_list #: model:ir.actions.act_window,name:golem_season.golem_season_action
#: model:ir.ui.menu,name:golem_season.menu_seasons #: model:ir.ui.menu,name:golem_season.golem_season_menu
msgid "GOLEM Seasons" msgid "GOLEM Seasons"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,id:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,__last_update:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season___last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,write_uid:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,write_date:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.form #: model:ir.ui.view,arch_db:golem_season.golem_season_view_form
msgid "Make this season as default" msgid "Make this season as default"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,date_end:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_date_end
msgid "Period end" msgid "Period end"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,date_start:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_date_start
msgid "Period start" msgid "Period start"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: view:golem.season:golem_season.form #: model:ir.ui.view,arch_db:golem_season.golem_season_view_form
msgid "Season" msgid "Season"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,name:0 #: model:ir.model.fields,field_description:golem_season.field_golem_season_name
msgid "Season name" msgid "Season name"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:41 #: code:addons/golem_season/models/golem_season.py:42
#, python-format #, python-format
msgid "Start of the period cannot be after end of the period." msgid "Start of the period cannot be after end of the period."
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:47 #: code:addons/golem_season/models/golem_season.py:48
#, python-format #, python-format
msgid "Start of the period is in range of an existing period." msgid "Start of the period is in range of an existing period."
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:27 #: code:addons/golem_season/models/golem_season.py:28
#: sql_constraint:golem.season:0
#, python-format #, python-format
msgid "This season name has already been used." msgid "This season name has already been used."
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:89 #: code:addons/golem_season/models/golem_season.py:92
#, python-format #, python-format
msgid "You can't delete the default season" msgid "You can't delete the default season"
msgstr "" msgstr ""

View File

@ -15,8 +15,9 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from odoo import models, fields, api, _ """ GOLEM Season management """
from odoo import models, fields, api, _
class GolemSeason(models.Model): class GolemSeason(models.Model):
""" GOLEM Season """ """ GOLEM Season """
@ -26,7 +27,7 @@ class GolemSeason(models.Model):
_sql_constraints = [('golem_season_name_uniq', 'UNIQUE (name)', _sql_constraints = [('golem_season_name_uniq', 'UNIQUE (name)',
_('This season name has already been used.'))] _('This season name has already been used.'))]
name = fields.Char('Season name') name = fields.Char('Season name', copy=False)
member_counter = fields.Integer('Counter for member number generation', member_counter = fields.Integer('Counter for member number generation',
readonly=True, default=0) readonly=True, default=0)
date_start = fields.Date('Period start') date_start = fields.Date('Period start')
@ -42,27 +43,28 @@ class GolemSeason(models.Model):
'after end of the period.')) 'after end of the period.'))
else: else:
seasons = self.env['golem.season'].search([]) seasons = self.env['golem.season'].search([])
for s in seasons: for eachs in seasons:
if s.date_start < season.date_start < s.date_end: if eachs.date_start < season.date_start < eachs.date_end:
msg = _(u'Start of the period is in range of an ' msg = _(u'Start of the period is in range of an '
'existing period.') 'existing period.')
raise models.ValidationError(msg) raise models.ValidationError(msg)
if s.date_start < season.date_end < s.date_end: if eachs.date_start < season.date_end < eachs.date_end:
msg = _(u'End of the period is in range of an ' msg = _(u'End of the period is in range of an '
'existing period.') 'existing period.')
raise models.ValidationError(msg) raise models.ValidationError(msg)
if season.date_start < s.date_start < season.date_end: if season.date_start < eachs.date_start < season.date_end:
msg = _(u'Current period cannot be included into ' msg = _(u'Current period cannot be included into '
'another existing period.') 'another existing period.')
raise models.ValidationError(msg) raise models.ValidationError(msg)
is_default = fields.Boolean('Default season for views?', readonly=True) is_default = fields.Boolean('Default season for views?', readonly=True)
@api.one @api.multi
def do_default_season(self): def do_default_season(self):
""" is_default on and ensure that only one is_default is active. Also """ is_default on and ensure that only one is_default is active. Also
recomputes is_current for members and activities. For simplicity use a recomputes is_current for members and activities. For simplicity use a
magic trick around registry rather than double inheritance """ magic trick around registry rather than double inheritance """
self.ensure_one()
old_default_season = self.search([('is_default', '=', True)]) old_default_season = self.search([('is_default', '=', True)])
if old_default_season: if old_default_season:
old_default_season.is_default = False old_default_season.is_default = False
@ -85,8 +87,8 @@ class GolemSeason(models.Model):
@api.multi @api.multi
def unlink(self): def unlink(self):
""" Forbids default season removal """ """ Forbids default season removal """
for s in self: for season in self:
if s.is_default: if season.is_default:
emsg = _('You can\'t delete the default season') emsg = _('You can\'t delete the default season')
raise models.ValidationError(emsg) raise models.ValidationError(emsg)
else: else:

View File

@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<data> <data>
<!-- Forms --> <!-- Forms -->
<record id="form" model="ir.ui.view"> <record id="golem_season_view_form" model="ir.ui.view">
<field name="name">GOLEM Season Form</field> <field name="name">GOLEM Season Form</field>
<field name="model">golem.season</field> <field name="model">golem.season</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -45,7 +45,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</record> </record>
<!-- Trees --> <!-- Trees -->
<record id="tree" model="ir.ui.view"> <record id="golem_season_view_tree" model="ir.ui.view">
<field name="name">GOLEM Seasons</field> <field name="name">GOLEM Seasons</field>
<field name="model">golem.season</field> <field name="model">golem.season</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -72,12 +72,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</record> </record>
<!-- Actions --> <!-- Actions -->
<act_window id="action_list" name="GOLEM Seasons" <act_window id="golem_season_action" name="GOLEM Seasons"
res_model="golem.season" view_mode="tree,form" /> res_model="golem.season" view_mode="tree,form" />
<!-- Menus --> <!-- Menus -->
<menuitem id="menu_seasons" name="GOLEM Seasons" <menuitem id="golem_season_menu" name="GOLEM Seasons"
parent="base.menu_marketing_config_association" sequence="2" parent="membership.menu_marketing_config_association" sequence="5"
action="action_list" groups="golem_base.group_golem_manager" /> action="golem_season_action" groups="golem_base.group_golem_manager" />
</data> </data>
</odoo> </odoo>