[FIX]GOLEM Season : do now allow default_season removal

This commit is contained in:
Fabien Bourgeois 2016-07-11 07:23:58 +02:00
parent e2a0671b4b
commit 66c3964464
3 changed files with 24 additions and 18 deletions

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-11 05:07+0000\n"
"PO-Revision-Date: 2016-07-11 05:07+0000\n"
"POT-Creation-Date: 2016-07-11 05:22+0000\n"
"PO-Revision-Date: 2016-07-11 05:22+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -131,3 +131,9 @@ msgstr "Le début de la période ne peut être postérieur à sa fin."
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 {}"
#. module: golem_season
#: code:addons/golem_season/models/golem_season.py:74
#, python-format
msgid "You can't delete the default season"
msgstr "Vous ne pouvez pas supprimer la saison par défaut"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-11 05:06+0000\n"
"PO-Revision-Date: 2016-07-11 05:06+0000\n"
"POT-Creation-Date: 2016-07-11 05:22+0000\n"
"PO-Revision-Date: 2016-07-11 05:22+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -130,3 +130,9 @@ msgstr ""
msgid "Start of the period is in range of an existing period {}"
msgstr ""
#. module: golem_season
#: code:addons/golem_season/models/golem_season.py:74
#, python-format
msgid "You can't delete the default season"
msgstr ""

View File

@ -67,17 +67,11 @@ class GolemSeason(models.Model):
all_members._compute_number()
self.env['golem.activity'].search([])._compute_is_current()
# @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
@api.multi
def unlink(self):
for s in self:
if s.is_default:
emsg = _('You can\'t delete the default season')
raise models.ValidationError(emsg)
else:
return super(GolemSeason, self).unlink()