Browse Source

[REF][IMP]GOLEM analysis : add flexibility

* On get members ;
* On get registrations and use it for state addon.
master
Fabien BOURGEOIS 1 year ago
parent
commit
4898a0d93d
4 changed files with 26 additions and 35 deletions
  1. +10
    -3
      golem_activity_registration/wizard/golem_activity_registration_analysis_wizard.py
  2. +2
    -2
      golem_activity_registration_state/__manifest__.py
  3. +6
    -28
      golem_activity_registration_state/wizard/golem_activity_registration_analysis_wizard.py
  4. +8
    -2
      golem_member/wizard/golem_member_analysis_wizard.py

+ 10
- 3
golem_activity_registration/wizard/golem_activity_registration_analysis_wizard.py View File

@@ -65,14 +65,21 @@ class GolemActivityRegistrationAnalysisWizard(models.TransientModel):
'golem_member_analysis_pivot_age_now_activity_area')
return self.env.ref(ref, False)

@api.multi
def get_registrations(self):
""" Returns registrations """
self.ensure_one()
return self.env['golem.activity.registration'].search(
[('season_id', '=', self[0].season_id.id)]
)


@api.multi
def registration_analyse(self):
""" registration analyse """
self.ensure_one()
analysis_rec = self[0]
registrations = self.env['golem.activity.registration'].search(
[('season_id', '=', analysis_rec.season_id.id)]
)
registrations = analysis_rec.get_registrations()
if registrations:
for registration in registrations:
self.env['golem.member.analysis'].create({


+ 2
- 2
golem_activity_registration_state/__manifest__.py View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2017-2019 Fabien Bourgeois <fabien@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
@@ -19,7 +19,7 @@
'name': 'GOLEM Activity Session Member Registrations States',
'summary': 'GOLEM Activities Session Member Registration states',
'description': 'GOLEM Activities Session Member Registration states',
'version': '10.0.2.2.1',
'version': '10.0.2.3.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',


+ 6
- 28
golem_activity_registration_state/wizard/golem_activity_registration_analysis_wizard.py View File

@@ -18,9 +18,7 @@

""" GOLEM Activity Registration Analysis Wizard Adaptation """

import logging
from odoo import models, fields, api, _
_LOGGER = logging.getLogger(__name__)
from odoo import models, fields, api


class GolemActivityRegistrationAnalysisWizard(models.TransientModel):
@@ -29,30 +27,10 @@ class GolemActivityRegistrationAnalysisWizard(models.TransientModel):
_description = 'GOLEM Activity Registration Analysis Wizard Adaptation '

@api.multi
def registration_analye(self):
""" registration analyse """
def get_registrations(self):
""" Returns registrations """
self.ensure_one()
analysis_rec = self[0]
registrations = self.env['golem.activity.registration'].search(
[('season_id', '=', analysis_rec.season_id.id),
return self.env['golem.activity.registration'].search(
[('season_id', '=', self[0].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',
}
)

+ 8
- 2
golem_member/wizard/golem_member_analysis_wizard.py View File

@@ -78,14 +78,20 @@ class GolemMemberAnalysis(models.TransientModel):
return self.env.ref(ref, False)


@api.multi
def get_members(self):
""" Returns members """
self.ensure_one()
return self.env['golem.member'].search([]).filtered(
lambda m: self[0].season_id.id in m.season_ids.ids)


@api.multi
def members_analyse(self):
""" members analyse """
self.ensure_one()
analysis_rec = self[0]
members = self.env['golem.member'].search([]).filtered(
lambda m: analysis_rec.season_id.id in m.season_ids.ids)
members = analysis_rec.get_members()
if members:
for member in members:
self.env['golem.member.analysis'].create({


Loading…
Cancel
Save