forked from Yaltik/golem
[IMP]GOLEM analysis : use m2o / o2m to avoid full erasal on new analysis
This commit is contained in:
parent
d895203d1a
commit
9705eb0f5a
@ -73,19 +73,20 @@ class GolemActivityRegistrationAnalysisWizard(models.TransientModel):
|
||||
registrations = self.env['golem.activity.registration'].search(
|
||||
[('season_id', '=', analysis_rec.season_id.id)]
|
||||
)
|
||||
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
|
||||
'activity_id': registration.activity_id.id,
|
||||
'resgistration_analysis_id': analysis_rec.id
|
||||
})
|
||||
analyse_pivot = analysis_rec.get_pivot_view()
|
||||
return {
|
||||
'name': _('Member Analysis'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'golem.member.analysis',
|
||||
'domain': [('resgistration_analysis_id', '=', analysis_rec.id)],
|
||||
'view_type': 'pivot',
|
||||
'view_mode': 'pivot',
|
||||
'view_id': analyse_pivot.id,
|
||||
|
@ -27,4 +27,7 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
_inherit = 'golem.member.analysis'
|
||||
_description = 'GOLEM Member Analysis Adaptation'
|
||||
|
||||
resgistration_analysis_id = fields.Many2one(
|
||||
'golem.activity.registration.analysis.wizard', index=True
|
||||
)
|
||||
activity_id = fields.Many2one('golem.activity', 'Activity')
|
||||
|
@ -29,6 +29,7 @@ class GolemMemberAnalysisPivot(models.TransientModel):
|
||||
_name = 'golem.member.analysis'
|
||||
_description = 'GOLEM Members Analysis Management'
|
||||
|
||||
member_analysis_id = fields.Many2one('golem.member.analysis.wizard', index=True)
|
||||
season_id = fields.Many2one('golem.season', 'Season', required=True,
|
||||
ondelete='cascade')
|
||||
member_id = fields.Many2one('golem.member', 'Service user')
|
||||
|
@ -86,12 +86,12 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
analysis_rec = self[0]
|
||||
members = self.env['golem.member'].search([]).filtered(
|
||||
lambda m: analysis_rec.season_id.id in m.season_ids.ids)
|
||||
self.env['golem.member.analysis'].search([]).unlink()
|
||||
if members:
|
||||
for member in members:
|
||||
self.env['golem.member.analysis'].create({
|
||||
'member_id': member.id,
|
||||
'season_id': analysis_rec.season_id.id
|
||||
'season_id': analysis_rec.season_id.id,
|
||||
'member_analysis_id': analysis_rec.id
|
||||
})
|
||||
|
||||
analyse_pivot = analysis_rec.get_pivot_view()
|
||||
@ -99,6 +99,7 @@ class GolemMemberAnalysis(models.TransientModel):
|
||||
'name': _('Member Analysis'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'golem.member.analysis',
|
||||
'domain': [('member_analysis_id', '=', analysis_rec.id)],
|
||||
'view_type': 'pivot',
|
||||
'view_mode': 'pivot',
|
||||
'view_id': analyse_pivot.id,
|
||||
|
Loading…
Reference in New Issue
Block a user