From e23b1bf7babd6180c9e39b9d32d132ff4e0b30e6 Mon Sep 17 00:00:00 2001 From: Fabien Bourgeois Date: Wed, 3 Aug 2016 17:24:40 +0200 Subject: [PATCH] [IMP]GOLEM Activity Session simplification : no management of min or overbook session per default --- golem_activity_session/i18n/fr.po | 14 +++-------- .../i18n/golem_activity_session.pot | 14 +++-------- .../models/golem_activity_session.py | 25 +++---------------- .../views/golem_activity_view.xml | 9 +------ 4 files changed, 13 insertions(+), 49 deletions(-) diff --git a/golem_activity_session/i18n/fr.po b/golem_activity_session/i18n/fr.po index 2858aa0..ba77502 100644 --- a/golem_activity_session/i18n/fr.po +++ b/golem_activity_session/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-08-03 14:49+0000\n" -"PO-Revision-Date: 2016-08-03 14:49+0000\n" +"POT-Creation-Date: 2016-08-03 15:20+0000\n" +"PO-Revision-Date: 2016-08-03 15:20+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -473,17 +473,11 @@ msgid "Net Weight" msgstr "Net Weight" #. module: golem_activity_session -#: code:addons/golem_activity_session/models/golem_activity_session.py:229 +#: code:addons/golem_activity_session/models/golem_activity_session.py:215 #, python-format msgid "Number of places cannot be negative." msgstr "Le nombre de places ne peut pas être négatif" -#. module: golem_activity_session -#: code:addons/golem_activity_session/models/golem_activity_session.py:232 -#, python-format -msgid "Overbooked places cannot be inferior than places" -msgstr "Le nombre de places avec surcharge ne peut être inférieur aux places" - #. module: golem_activity_session #: field:golem.activity.session,places:0 msgid "Places" @@ -623,7 +617,7 @@ msgid "Small-sized image of the product. It is automatically resized as a 64x64p msgstr "Small-sized image of the product. It is automatically resized as a 64x64px image, with aspect ratio preserved. Use this field anywhere a small image is required." #. module: golem_activity_session -#: code:addons/golem_activity_session/models/golem_activity_session.py:212 +#: code:addons/golem_activity_session/models/golem_activity_session.py:205 #, python-format msgid "Sorry, there is no more place !" msgstr "Désolé mais il n'y a plus de place disponible !" diff --git a/golem_activity_session/i18n/golem_activity_session.pot b/golem_activity_session/i18n/golem_activity_session.pot index 215cda8..6701809 100644 --- a/golem_activity_session/i18n/golem_activity_session.pot +++ b/golem_activity_session/i18n/golem_activity_session.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-08-03 14:49+0000\n" -"PO-Revision-Date: 2016-08-03 14:49+0000\n" +"POT-Creation-Date: 2016-08-03 15:20+0000\n" +"PO-Revision-Date: 2016-08-03 15:20+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -470,17 +470,11 @@ msgid "Net Weight" msgstr "" #. module: golem_activity_session -#: code:addons/golem_activity_session/models/golem_activity_session.py:229 +#: code:addons/golem_activity_session/models/golem_activity_session.py:215 #, python-format msgid "Number of places cannot be negative." msgstr "" -#. module: golem_activity_session -#: code:addons/golem_activity_session/models/golem_activity_session.py:232 -#, python-format -msgid "Overbooked places cannot be inferior than places" -msgstr "" - #. module: golem_activity_session #: field:golem.activity.session,places:0 msgid "Places" @@ -620,7 +614,7 @@ msgid "Small-sized image of the product. It is automatically resized as a 64x64p msgstr "" #. module: golem_activity_session -#: code:addons/golem_activity_session/models/golem_activity_session.py:212 +#: code:addons/golem_activity_session/models/golem_activity_session.py:205 #, python-format msgid "Sorry, there is no more place !" msgstr "" diff --git a/golem_activity_session/models/golem_activity_session.py b/golem_activity_session/models/golem_activity_session.py index 3ec31f0..3b87f13 100644 --- a/golem_activity_session/models/golem_activity_session.py +++ b/golem_activity_session/models/golem_activity_session.py @@ -188,21 +188,14 @@ class GolemActivitySession(models.Model): 'after end of the period.')) places = fields.Integer('Places', default=0) - places_min = fields.Integer('Minimum places', default=0, - help='Minimum places to maintain the session') - is_overbooked = fields.Boolean('Allow overbook?', default=False) - places_overbooked = fields.Integer('Places with overbook', default=0) places_remain = fields.Integer('Remaining places', store=True, compute='_compute_places_remain') - @api.depends('places', 'is_overbooked', 'places_overbooked', 'member_ids') + @api.depends('places', 'member_ids') def _compute_places_remain(self): for s in self: used = len(s.member_ids) - if not s.is_overbooked: - s.places_remain = s.places - used - else: - s.places_remain = s.places_overbooked - used + s.places_remain = s.places - used @api.constrains('places_remain') def _check_remaining_places(self): @@ -212,22 +205,12 @@ class GolemActivitySession(models.Model): emsg = _('Sorry, there is no more place !') raise models.ValidationError(emsg) - @api.onchange('is_overbooked', 'places') - def onchange_is_overbooked(self): - for s in self: - if s.places and s.is_overbooked: - if not s.places_overbooked or (s.places_overbooked < s.places): - s.places_overbooked = s.places + 1 - - @api.constrains('places', 'places_overbooked') + @api.constrains('places') def _check_places(self): """ Check integers are signed and overbooked to be superior than normal places """ for v in self: - for f in ['places', 'places_overbooked']: + for f in ['places']: if v[f] < 0: emsg = _('Number of places cannot be negative.') raise models.ValidationError(emsg) - if v.is_overbooked and (v.places_overbooked <= v.places): - emsg = _('Overbooked places cannot be inferior than places') - raise models.ValidationError(emsg) diff --git a/golem_activity_session/views/golem_activity_view.xml b/golem_activity_session/views/golem_activity_view.xml index b217a3e..1ff393f 100644 --- a/golem_activity_session/views/golem_activity_view.xml +++ b/golem_activity_session/views/golem_activity_view.xml @@ -50,10 +50,6 @@ along with this program. If not, see . - - - @@ -107,8 +103,7 @@ along with this program. If not, see . Session list golem.activity.session - @@ -120,8 +115,6 @@ along with this program. If not, see . attrs="{'invisible': [('is_recurrent', '=', True)]}" /> - -