forked from Yaltik/golem
[Analyses pour la ville] small improvment
This commit is contained in:
parent
cfd6eca541
commit
89eb287ee1
@ -36,14 +36,7 @@ class GolemMemberAnalysisPivot(models.TransientModel):
|
||||
_description = 'GOLEM Members Analysis Management'
|
||||
|
||||
season_id = fields.Many2one('golem.season', required=True)
|
||||
member_id = fields.Many2one('golem.member', 'Season', required=True)
|
||||
analyse_type = fields.Selection([('age_start_gender', 'By age at season start and gender'),
|
||||
('age_end_gender', 'By age at season end and gender'),
|
||||
('age_start_area', 'By age at season start and area'),
|
||||
('age_end_area', 'By age at season end and area'),
|
||||
('age_start_tag', 'By age at season start and tag'),
|
||||
('age_end_tag', 'By age at season end and tag')],
|
||||
required=True)
|
||||
member_id = fields.Many2one('golem.member', 'Season')
|
||||
area_id = fields.Many2one(related='member_id.area_id', store=True)
|
||||
gender = fields.Selection(related='member_id.gender', store=True)
|
||||
category_id = fields.Many2many('res.partner.category')
|
||||
@ -56,10 +49,7 @@ class GolemMemberAnalysisPivot(models.TransientModel):
|
||||
@api.constrains('member_id')
|
||||
def compute_fields(self):
|
||||
for rec in self:
|
||||
print '_-_-_-_____________-______________-_______________-___________-'
|
||||
|
||||
rec.category_id = get_root_category(rec.member_id.category_id)
|
||||
print rec.category_id
|
||||
|
||||
|
||||
@api.depends('member_id')
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -30,7 +29,6 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
_description = 'GOLEM Members Analysis Wizard Management'
|
||||
|
||||
season_id = fields.Many2one('golem.season', 'Season', required=True)
|
||||
#member_analysis_ids = fields.Many2many('golem.member.analysis.pivot', string='Members list')
|
||||
analyse_type = fields.Selection([('age_start_gender', 'By age at season start and gender'),
|
||||
('age_end_gender', 'By age at season end and gender'),
|
||||
('age_start_area', 'By age at season start and area'),
|
||||
@ -43,6 +41,7 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
|
||||
@api.multi
|
||||
def get_pivot_view(self):
|
||||
""" Get pivot view """
|
||||
self.ensure_one()
|
||||
rec = self[0]
|
||||
if rec.analyse_type == 'age_start_gender':
|
||||
@ -61,6 +60,7 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
|
||||
@api.multi
|
||||
def members_analye(self):
|
||||
""" members analyse """
|
||||
self.ensure_one()
|
||||
analysis_rec = self[0]
|
||||
members = self.env['golem.member'].search([]).filtered(
|
||||
@ -70,8 +70,7 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
for member in members:
|
||||
self.env['golem.member.analysis'].create({
|
||||
'member_id': member.id,
|
||||
'season_id': analysis_rec.season_id.id,
|
||||
'analyse_type': analysis_rec.analyse_type
|
||||
'season_id': analysis_rec.season_id.id
|
||||
})
|
||||
analyse_pivot = analysis_rec.get_pivot_view()
|
||||
|
||||
@ -85,11 +84,3 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
'view_id': analyse_pivot.id,
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
#record = self[0]
|
||||
#data = {}
|
||||
#data = self.read(['season_id', 'member_analysis_ids', 'analyse_type'])[0]
|
||||
#_LOGGER.warning('________________________________________________________________________')
|
||||
#_LOGGER.warning('analysis function')
|
||||
#return self.env['report'].get_action(self, 'golem_member.golem_member_analysis_report', data=data)
|
||||
#return self.env['report'].get_action(self, 'golem_resource_report.golem_reservation_report', data=data)
|
||||
|
Loading…
Reference in New Issue
Block a user