forked from Yaltik/golem
[Analyses pour la ville] take into account only confirmed registration
This commit is contained in:
parent
58717a8e79
commit
6e81fd3026
@ -15,4 +15,4 @@
|
|||||||
# 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 . import models
|
from . import models, wizard
|
||||||
|
19
golem_activity_registration_state/wizard/__init__.py
Normal file
19
golem_activity_registration_state/wizard/__init__.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2019 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
# Copyright 2019 Youssef El Ouahby <youssef@yaltik.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
from . import golem_activity_registration_analysis_wizard
|
@ -0,0 +1,58 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright 2019 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
# Copyright 2019 Youssef El Ouahby <youssef@yaltik.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
""" GOLEM Activity Registration Analysis Wizard Adaptation """
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from odoo import models, fields, api, _
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class GolemActivityRegistrationAnalysisWizard(models.TransientModel):
|
||||||
|
""" GOLEM Activity Registration Analysis Wizard Adaptation """
|
||||||
|
_inherit = 'golem.activity.registration.analysis.wizard'
|
||||||
|
_description = 'GOLEM Activity Registration Analysis Wizard Adaptation '
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def registration_analye(self):
|
||||||
|
""" registration analyse """
|
||||||
|
self.ensure_one()
|
||||||
|
analysis_rec = self[0]
|
||||||
|
registrations = self.env['golem.activity.registration'].search(
|
||||||
|
[('season_id', '=', analysis_rec.season_id.id),
|
||||||
|
('state', '=', 'confirmed')]
|
||||||
|
)
|
||||||
|
self.env['golem.member.analysis'].search([]).unlink()
|
||||||
|
if registrations:
|
||||||
|
for registration in registrations:
|
||||||
|
self.env['golem.member.analysis'].create({
|
||||||
|
'season_id': analysis_rec.season_id.id,
|
||||||
|
'member_id': registration.member_id.id,
|
||||||
|
'activity_id': registration.activity_id.id
|
||||||
|
})
|
||||||
|
analyse_pivot = analysis_rec.get_pivot_view()
|
||||||
|
return {
|
||||||
|
'name': _('Member Analysis'),
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'res_model': 'golem.member.analysis',
|
||||||
|
'view_type': 'pivot',
|
||||||
|
'view_mode': 'pivot',
|
||||||
|
#'views': [(analyse_pivot.id, 'form')],
|
||||||
|
'view_id': analyse_pivot.id,
|
||||||
|
'target': 'new',
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user