[IMP]GOLEM Seasons : only 1 season per default without ability to delete linked ones

This commit is contained in:
Fabien Bourgeois 2016-07-11 07:11:27 +02:00
parent b4b164a10f
commit e2a0671b4b
4 changed files with 77 additions and 29 deletions

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-28 03:18+0000\n" "POT-Creation-Date: 2016-07-11 05:07+0000\n"
"PO-Revision-Date: 2016-06-28 03:18+0000\n" "PO-Revision-Date: 2016-07-11 05:07+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,6 +16,11 @@ msgstr ""
"Language: fr\n" "Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: golem_season
#: field:golem.season,member_counter:0
msgid "Counter for member number generation"
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 #: field:golem.season,create_uid:0
msgid "Created by" msgid "Created by"
@ -31,6 +36,11 @@ msgstr "Créé le"
msgid "Default season" msgid "Default season"
msgstr "Saison par défaut" msgstr "Saison par défaut"
#. module: golem_season
#: view:golem.season:golem_season.form
msgid "Default season for views ?"
msgstr "Saison affichée par défaut dans toutes les listes ?"
#. module: golem_season #. module: golem_season
#: field:golem.season,is_default:0 #: field:golem.season,is_default:0
msgid "Default season for views?" msgid "Default season for views?"
@ -42,7 +52,7 @@ msgid "Display Name"
msgstr "Nom affiché" msgstr "Nom affiché"
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:49 #: code:addons/golem_season/models/golem_season.py:50
#, 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 la période existante {}" msgstr "La fin de la période est en conflit avec la période existante {}"
@ -50,13 +60,13 @@ msgstr "La fin de la période est en conflit avec la période existante {}"
#. module: golem_season #. module: golem_season
#: model:ir.model,name:golem_season.model_golem_season #: model:ir.model,name:golem_season.model_golem_season
msgid "GOLEM Season" msgid "GOLEM Season"
msgstr "GOLEM : 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.action_list
#: model:ir.ui.menu,name:golem_season.menu_seasons #: model:ir.ui.menu,name:golem_season.menu_seasons
msgid "GOLEM Seasons" msgid "GOLEM Seasons"
msgstr "GOLEM : Saisons" msgstr "Saisons"
#. module: golem_season #. module: golem_season
#: field:golem.season,id:0 #: field:golem.season,id:0
@ -78,6 +88,11 @@ msgstr "Dernière modification par"
msgid "Last Updated on" msgid "Last Updated on"
msgstr "Dernière modification le" msgstr "Dernière modification le"
#. module: golem_season
#: view:golem.season:golem_season.form
msgid "Make this season as default"
msgstr "Activer cette saison par défaut"
#. module: golem_season #. module: golem_season
#: field:golem.season,date_end:0 #: field:golem.season,date_end:0
msgid "Period end" msgid "Period end"
@ -89,7 +104,7 @@ msgid "Period start"
msgstr "Début de la période" msgstr "Début de la période"
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:53 #: code:addons/golem_season/models/golem_season.py:54
#, python-format #, python-format
msgid "Period {} cannot be included into current period" msgid "Period {} cannot be included into current period"
msgstr "La période {} ne peut être incluse dans la période en cours" msgstr "La période {} ne peut être incluse dans la période en cours"
@ -105,13 +120,13 @@ 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:38 #: code:addons/golem_season/models/golem_season.py:39
#, 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:45 #: code:addons/golem_season/models/golem_season.py:46
#, 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 la période existante {}" msgstr "Le début de la période est en conflit avec la période existante {}"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-28 03:18+0000\n" "POT-Creation-Date: 2016-07-11 05:06+0000\n"
"PO-Revision-Date: 2016-06-28 03:18+0000\n" "PO-Revision-Date: 2016-07-11 05:06+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -15,6 +15,11 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: golem_season
#: field:golem.season,member_counter:0
msgid "Counter for member number generation"
msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,create_uid:0 #: field:golem.season,create_uid:0
msgid "Created by" msgid "Created by"
@ -30,6 +35,11 @@ msgstr ""
msgid "Default season" msgid "Default season"
msgstr "" msgstr ""
#. module: golem_season
#: view:golem.season:golem_season.form
msgid "Default season for views ?"
msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,is_default:0 #: field:golem.season,is_default:0
msgid "Default season for views?" msgid "Default season for views?"
@ -41,7 +51,7 @@ msgid "Display Name"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:49 #: code:addons/golem_season/models/golem_season.py:50
#, 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 ""
@ -77,6 +87,11 @@ msgstr ""
msgid "Last Updated on" msgid "Last Updated on"
msgstr "" msgstr ""
#. module: golem_season
#: view:golem.season:golem_season.form
msgid "Make this season as default"
msgstr ""
#. module: golem_season #. module: golem_season
#: field:golem.season,date_end:0 #: field:golem.season,date_end:0
msgid "Period end" msgid "Period end"
@ -88,7 +103,7 @@ msgid "Period start"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:53 #: code:addons/golem_season/models/golem_season.py:54
#, python-format #, python-format
msgid "Period {} cannot be included into current period" msgid "Period {} cannot be included into current period"
msgstr "" msgstr ""
@ -104,13 +119,13 @@ msgid "Season name"
msgstr "" msgstr ""
#. module: golem_season #. module: golem_season
#: code:addons/golem_season/models/golem_season.py:38 #: code:addons/golem_season/models/golem_season.py:39
#, 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:45 #: code:addons/golem_season/models/golem_season.py:46
#, 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 ""

View File

@ -29,7 +29,6 @@ class GolemSeason(models.Model):
readonly=True, default=0) readonly=True, default=0)
date_start = fields.Date('Period start') date_start = fields.Date('Period start')
date_end = fields.Date('Period end') date_end = fields.Date('Period end')
is_default = fields.Boolean('Default season for views?')
@api.constrains('date_start', 'date_end') @api.constrains('date_start', 'date_end')
def _check_period(self): def _check_period(self):
@ -55,17 +54,30 @@ class GolemSeason(models.Model):
'period'.format(s.name)) 'period'.format(s.name))
raise models.ValidationError(msg) raise models.ValidationError(msg)
@api.multi is_default = fields.Boolean('Default season for views?', readonly=True)
def write(self, values):
""" Extends write to recomputes all current members in case of @api.one
is_default changes and ensures that only one is_default is active """ def do_default_season(self):
is_new_default = values.get('is_default') """ is_default on and ensure that only one is_default is active """
old_default_season = self.search([('is_default', '=', True)]) old_default_season = self.search([('is_default', '=', True)])
res = super(GolemSeason, self).write(values) old_default_season.is_default = False
if is_new_default: self.is_default = True
if old_default_season: all_members = self.env['golem.member'].search([])
old_default_season.is_default = False all_members._compute_is_current()
self.env['golem.member'].search([])._compute_is_current() all_members._compute_number()
self.env['golem.member'].search([])._compute_number() self.env['golem.activity'].search([])._compute_is_current()
self.env['golem.activity'].search([])._compute_is_current()
return res # @api.multi
# def write(self, values):
# """ Extends write to recomputes all current members in case of
# is_default changes and ensures that only one is_default is active """
# res = super(GolemSeason, self).write(values)
# is_new_default = values.get('is_default')
# old_default_season = self.search([('is_default', '=', True)])
# if is_new_default:
# if old_default_season:
# old_default_season.is_default = False
# self.env['golem.member'].search([])._compute_is_current()
# self.env['golem.member'].search([])._compute_number()
# self.env['golem.activity'].search([])._compute_is_current()
# return res

View File

@ -27,9 +27,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <form>
<sheet> <sheet>
<div class="oe_right">
<button name="do_default_season" type="object"
string="Make this season as default" class="oe_highlight"
help="Default season for views ?"
attrs="{'invisible': [('is_default', '=', True)]}" />
</div>
<group string="Season"> <group string="Season">
<field name="is_default" invisible="True" />
<field name="name" /> <field name="name" />
<field name="is_default" />
<field name="date_start" /> <field name="date_start" />
<field name="date_end" /> <field name="date_end" />
</group> </group>