Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cgscop_partner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
Confédération Générale des SCOP
cgscop_partner
Commits
4e6e0863
Commit
4e6e0863
authored
5 years ago
by
Hervé Silvant - CGScop
Browse files
Options
Downloads
Patches
Plain Diff
Radiation globale
parent
ed43e7e9
Branches
Branches containing commit
No related tags found
1 merge request
!7
Radiation globale
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
wizard/scop_membership_out_wizard.py
+51
-19
51 additions, 19 deletions
wizard/scop_membership_out_wizard.py
wizard/scop_membership_out_wizard.xml
+2
-1
2 additions, 1 deletion
wizard/scop_membership_out_wizard.xml
with
53 additions
and
20 deletions
wizard/scop_membership_out_wizard.py
+
51
−
19
View file @
4e6e0863
...
...
@@ -15,10 +15,13 @@ class ScopMembershipOutWizard(models.TransientModel):
return
self
.
env
.
context
.
get
(
'
active_id
'
)
partner_id
=
fields
.
Integer
(
'
Partner
'
,
default
=
_default_partner_id
)
type_all
=
fields
.
Boolean
(
string
=
"
Tous types d
'
adhésion
"
,
default
=
True
)
type_id
=
fields
.
Many2one
(
'
scop.membership.type
'
,
string
=
"
Type d
'
adhésion
"
,
ondelete
=
'
restrict
'
,
required
=
True
)
ondelete
=
'
restrict
'
)
end
=
fields
.
Date
(
"
Fin d
'
adhésion
"
,
required
=
True
,
default
=
fields
.
Date
.
today
())
end_reason_id
=
fields
.
Many2one
(
...
...
@@ -28,20 +31,46 @@ class ScopMembershipOutWizard(models.TransientModel):
required
=
True
)
note
=
fields
.
Text
(
'
Commentaires
'
)
#............................................................
# Fermeture des périodes
#............................................................
@api.multi
def
member_out
(
self
):
# Close previous period
for
period
in
self
:
# On veut cloture toute les périodes
if
(
period
.
type_all
):
last_periods
=
self
.
env
[
'
scop.membership.period
'
].
search
(
[(
'
partner_id
'
,
'
=
'
,
period
.
partner_id
),(
'
end
'
,
'
=
'
,
False
)])
for
lp
in
last_periods
:
period_type_id
=
lp
.
type_id
.
id
period
.
member_out_period
(
period
.
partner_id
,
period_type_id
,
period
.
end
,
period
.
end_reason_id
.
id
,
period
.
note
)
# On ne veut cloturer qu'une seule période
else
:
period_type_id
=
period
.
type_id
.
id
period
.
member_out_period
(
period
.
partner_id
,
period_type_id
,
period
.
end
,
period
.
end_reason_id
.
id
,
period
.
note
)
return
#............................................................
# Fermeture d'une période
#............................................................
def
member_out_period
(
self
,
partner_id
,
period_type_id
,
end
,
end_reason_id
,
note
):
# Lecture de la dernière période active
last_period
=
self
.
env
[
'
scop.membership.period
'
].
search
(
[(
'
partner_id
'
,
'
=
'
,
period
.
partner_id
),
(
'
end
'
,
'
=
'
,
False
),
(
'
type_id
'
,
'
=
'
,
period
.
type_id
.
id
)],
[(
'
partner_id
'
,
'
=
'
,
partner_id
),
(
'
end
'
,
'
=
'
,
False
),
(
'
type_id
'
,
'
=
'
,
period
_
type_id
)],
limit
=
1
)
if
last_period
:
if
period
.
end
>=
last_period
.
start
:
if
end
>=
last_period
.
start
:
last_period
.
write
({
'
end
'
:
period
.
end
,
'
end_reason_id
'
:
period
.
end_reason_id
.
id
,
'
note
'
:
period
.
note
,
'
end
'
:
end
,
'
end_reason_id
'
:
end_reason_id
,
'
note
'
:
note
,
})
else
:
raise
ValidationError
(
...
...
@@ -51,3 +80,6 @@ class ScopMembershipOutWizard(models.TransientModel):
else
:
raise
ValidationError
(
"
Il n
'
existe pas de période avec ce type à fermer.
"
)
return
This diff is collapsed.
Click to expand it.
wizard/scop_membership_out_wizard.xml
+
2
−
1
View file @
4e6e0863
...
...
@@ -7,7 +7,8 @@
<field
name=
"arch"
type=
"xml"
>
<form
string=
"Radiation"
>
<group
name=
"period"
string=
"Radiation"
>
<field
name=
"type_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"type_all"
/>
<field
name=
"type_id"
options=
"{'no_open': True, 'no_create': True}"
attrs=
"{'required' : [('type_all','=', False)] ,'invisible': [('type_all','=', True)]}"
/>
<field
name=
"end"
/>
<field
name=
"end_reason_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"note"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment