Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odoo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
odoo
Commits
1cf1eb56
Commit
1cf1eb56
authored
Nov 18, 2021
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 2 coop states to distinguish member who have gone and other which are associated people
parent
b6d31ca5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
1 deletions
+135
-1
__openerp__.py
lacagette_addons/lacagette_membership/__openerp__.py
+4
-1
fr.po
lacagette_addons/lacagette_membership/i18n/fr.po
+23
-0
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+22
-0
backend.css
...te_addons/lacagette_membership/static/src/css/backend.css
+5
-0
backend.js
...ette_addons/lacagette_membership/static/src/js/backend.js
+50
-0
templates.xml
..._addons/lacagette_membership/static/src/xml/templates.xml
+14
-0
res_partner.xml
lacagette_addons/lacagette_membership/views/res_partner.xml
+17
-0
No files found.
lacagette_addons/lacagette_membership/__openerp__.py
View file @
1cf1eb56
...
@@ -24,7 +24,10 @@
...
@@ -24,7 +24,10 @@
'data'
:
[
'data'
:
[
'security/ir.model.access.csv'
,
'security/ir.model.access.csv'
,
'data/ir_cron.xml'
,
'data/ir_cron.xml'
,
'data/ir_config_parameter_data.xml'
'data/ir_config_parameter_data.xml'
,
'static/src/xml/templates.xml'
,
'views/res_partner.xml'
,
],
],
'installable'
:
True
,
'installable'
:
True
,
}
}
lacagette_addons/lacagette_membership/i18n/fr.po
0 → 100644
View file @
1cf1eb56
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * lacagette_membership
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo 9.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: lacagette_membership
#: selection:res.partner,cooperative_state:0
msgid "Gone"
msgstr "Parti.e"
#. module: lacagette_membership
#: selection:res.partner,cooperative_state:0
msgid "Associated"
msgstr "En binôme"
\ No newline at end of file
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
1cf1eb56
...
@@ -11,6 +11,21 @@ TARGET_STATUS_SELECTION = [
...
@@ -11,6 +11,21 @@ TARGET_STATUS_SELECTION = [
(
'suspended'
,
'Suspended'
)
(
'suspended'
,
'Suspended'
)
]
]
EXTRA_COOPERATIVE_STATE_SELECTION
=
[
(
'not_concerned'
,
'Not Concerned'
),
(
'unsubscribed'
,
'Unsubscribed'
),
(
'exempted'
,
'Exempted'
),
(
'vacation'
,
'On Vacation'
),
(
'up_to_date'
,
'Up to date'
),
(
'alert'
,
'Alert'
),
(
'suspended'
,
'Suspended'
),
(
'delay'
,
'Delay'
),
(
'blocked'
,
'Blocked'
),
(
'unpayed'
,
'Unpayed'
),
(
'gone'
,
'Gone'
),
(
'associated'
,
'Associated'
)
]
class
ResPartner
(
models
.
Model
):
class
ResPartner
(
models
.
Model
):
_inherit
=
'res.partner'
_inherit
=
'res.partner'
...
@@ -22,6 +37,9 @@ class ResPartner(models.Model):
...
@@ -22,6 +37,9 @@ class ResPartner(models.Model):
target_status
=
fields
.
Selection
(
target_status
=
fields
.
Selection
(
selection
=
TARGET_STATUS_SELECTION
,
default
=
''
)
selection
=
TARGET_STATUS_SELECTION
,
default
=
''
)
cooperative_state
=
fields
.
Selection
(
selection
=
EXTRA_COOPERATIVE_STATE_SELECTION
,
default
=
'not_concerned'
)
@api.model
@api.model
def
run_process_target_status
(
self
):
def
run_process_target_status
(
self
):
"""Method called by cron task"""
"""Method called by cron task"""
...
@@ -111,6 +129,10 @@ class ResPartner(models.Model):
...
@@ -111,6 +129,10 @@ class ResPartner(models.Model):
pass
pass
return
answer
return
answer
def
set_special_state
(
self
,
cr
,
uid
,
partner
,
context
=
None
):
return
self
.
write
(
cr
,
uid
,
[
partner
[
'id'
]],
{
'cooperative_state'
:
partner
[
'state'
]}
,
context
=
context
)
def
_write_state_change
(
self
,
state
):
def
_write_state_change
(
self
,
state
):
data
=
{
'member_id'
:
self
.
id
,
'state'
:
state
}
data
=
{
'member_id'
:
self
.
id
,
'state'
:
state
}
self
.
env
[
'member.state.change'
]
.
create
(
data
)
self
.
env
[
'member.state.change'
]
.
create
(
data
)
...
...
lacagette_addons/lacagette_membership/static/src/css/backend.css
0 → 100644
View file @
1cf1eb56
#coop_state_selection
{
font-size
:
medium
;
height
:
26px
;
}
\ No newline at end of file
lacagette_addons/lacagette_membership/static/src/js/backend.js
0 → 100644
View file @
1cf1eb56
odoo
.
define
(
'lacagette_membership.backend'
,
function
(
require
){
"use strict"
;
var
core
=
require
(
'web.core'
);
var
FormView
=
require
(
'web.FormView'
);
var
Model
=
require
(
'web.DataModel'
);
var
framework
=
require
(
'web.framework'
);
var
_t
=
core
.
_t
;
var
partner_id
=
null
;
var
last_call
=
0
;
FormView
.
include
({
load_record
:
function
()
{
var
self
=
this
;
return
this
.
_super
.
apply
(
this
,
arguments
)
.
then
(
function
()
{
partner_id
=
self
.
get_fields_values
().
id
;
});
}
});
$
(
document
).
on
(
'change'
,
'#coop_state_selection'
,
function
(){
var
d
=
new
Date
()
var
elapsed_since_last_call
=
d
.
getTime
()
-
last_call
let
new_state
=
$
(
this
).
val
()
if
(
elapsed_since_last_call
>
5000
)
{
last_call
=
d
.
getTime
()
let
fields
=
{
id
:
partner_id
,
state
:
new_state
}
framework
.
blockUI
();
new
Model
(
'res.partner'
).
call
(
'set_special_state'
,[
fields
]).
then
(
function
(
rData
){
window
.
location
.
reload
()
},
function
(
err
,
event
){
event
.
preventDefault
();
var
error_body
=
_t
(
'Your Internet connection is probably down.'
);
if
(
err
.
data
)
{
var
except
=
err
.
data
;
error_body
=
except
.
arguments
&&
except
.
arguments
[
0
]
||
except
.
message
||
error_body
;
}
alert
(
error_body
)
});
}
});
});
lacagette_addons/lacagette_membership/static/src/xml/templates.xml
0 → 100644
View file @
1cf1eb56
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template
id=
"assets"
name=
"lacagette_membership assets"
inherit_id=
"web.assets_backend"
>
<xpath
expr=
"."
position=
"inside"
>
<link
rel=
"stylesheet"
href=
"/lacagette_membership/static/src/css/backend.css"
/>
<script
type=
"text/javascript"
src=
"/lacagette_membership/static/src/js/backend.js"
></script>
</xpath>
</template>
</data>
</openerp>
\ No newline at end of file
lacagette_addons/lacagette_membership/views/res_partner.xml
0 → 100644
View file @
1cf1eb56
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record
id=
"view_partner_form"
model=
"ir.ui.view"
>
<field
name=
"model"
>
res.partner
</field>
<field
name=
"inherit_id"
ref=
"coop_membership.view_partner_form"
/>
<field
name=
"arch"
type=
"xml"
>
<field
name=
"name"
position=
"after"
>
<select
id=
"coop_state_selection"
>
<option
value=
""
>
--Statuts spéciaux--
</option>
<option
value=
"gone"
>
Parti.e
</option>
<option
value=
"associated"
>
En binôme
</option>
</select>
</field>
</field>
</record>
</odoo>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment