Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odoo CE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Comunitats Energètiques
Odoo CE
Commits
81be56fb
Commit
81be56fb
authored
1 year ago
by
Dani Quilez
Browse files
Options
Downloads
Patches
Plain Diff
new payload version to be tested on landing sync
parent
906486a8
No related branches found
No related tags found
2 merge requests
!213
[REL] Release sprint 25/09/23
,
!212
Feat/adjust landing api
Pipeline
#53668
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
energy_communities/models/landing_page.py
+22
-2
22 additions, 2 deletions
energy_communities/models/landing_page.py
energy_communities/services/schemas.py
+6
-2
6 additions, 2 deletions
energy_communities/services/schemas.py
with
28 additions
and
4 deletions
energy_communities/models/landing_page.py
+
22
−
2
View file @
81be56fb
...
...
@@ -75,6 +75,16 @@ class LandingPage(models.Model):
string
=
"
Community status
"
,
)
def
_get_image_write_date
(
self
,
field_name
):
file_write_date
=
""
file_attachment
=
self
.
env
[
'
ir.attachment
'
].
search
([
(
'
res_id
'
,
'
=
'
,
self
.
id
),
(
'
res_model
'
,
'
=
'
,
'
landing.page
'
),
(
'
res_field
'
,
'
=
'
,
field_name
)])
if
file_attachment
:
file_write_date
=
str
(
file_attachment
.
write_date
)
return
file_write_date
def
to_dict
(
self
):
base_url
=
self
.
env
[
"
ir.config_parameter
"
].
get_param
(
"
web.base.url
"
)
if
self
.
primary_image_file
:
...
...
@@ -85,8 +95,12 @@ class LandingPage(models.Model):
+
"
/primary_image_file/
"
+
self
.
primary_image_file_filename
)
primary_image_file_write_date
=
self
.
_get_image_write_date
(
'
primary_image_file
'
)
else
:
primary_image_file
=
""
primary_image_file_write_date
=
""
if
self
.
secondary_image_file
:
secondary_image_file
=
(
base_url
...
...
@@ -95,8 +109,12 @@ class LandingPage(models.Model):
+
"
/secondary_image_file/
"
+
self
.
secondary_image_file_filename
)
secondary_image_file_write_date
=
self
.
_get_image_write_date
(
'
secondary_image_file
'
)
else
:
secondary_image_file
=
""
secondary_image_file_write_date
=
""
if
self
.
map_place_id
:
map_reference
=
self
.
map_place_id
.
slug_id
else
:
...
...
@@ -127,7 +145,9 @@ class LandingPage(models.Model):
# TODO: group_image_link Left for backward compatibility. To be removed
"
group_image_link
"
:
self
.
group_image_link
or
""
,
"
primary_image_file
"
:
primary_image_file
,
"
primary_image_file_write_date
"
:
primary_image_file_write_date
,
"
secondary_image_file
"
:
secondary_image_file
,
"
secondary_image_file_write_date
"
:
secondary_image_file_write_date
,
"
short_description
"
:
self
.
short_description
or
""
,
"
long_description
"
:
self
.
long_description
or
""
,
"
why_become_cooperator
"
:
self
.
why_become_cooperator
,
...
...
@@ -145,7 +165,7 @@ class LandingPage(models.Model):
new_status
=
"
draft
"
if
record
.
status
==
"
publish
"
else
"
publish
"
record
.
write
({
"
status
"
:
new_status
})
def
update_wordpress
(
self
):
def
_
update_wordpress
(
self
):
for
record
in
self
:
instance_company
=
self
.
env
[
"
res.company
"
].
search
(
[(
"
hierarchy_level
"
,
"
=
"
,
"
instance
"
)]
...
...
@@ -163,5 +183,5 @@ class LandingPage(models.Model):
def
write
(
self
,
vals
):
res
=
super
().
write
(
vals
)
self
.
update_wordpress
()
self
.
_
update_wordpress
()
return
res
This diff is collapsed.
Click to expand it.
energy_communities/services/schemas.py
+
6
−
2
View file @
81be56fb
...
...
@@ -129,9 +129,11 @@ S_MEMBER_PROFILE_RETURN_GET = {
}
}
S_PROFILE_PUT
=
{
"
language
"
:
{
"
type
"
:
"
string
"
,
"
required
"
:
True
,
"
empty
"
:
False
}}
S_PROFILE_PUT
=
{
"
language
"
:
{
"
type
"
:
"
string
"
,
"
required
"
:
True
,
"
empty
"
:
False
}}
S_MEMBER_PROFILE_PUT
=
{
"
role
"
:
{
"
type
"
:
"
string
"
,
"
required
"
:
True
,
"
empty
"
:
False
}}
S_MEMBER_PROFILE_PUT
=
{
"
role
"
:
{
"
type
"
:
"
string
"
,
"
required
"
:
True
,
"
empty
"
:
False
}}
S_PROFILE_RETURN_PUT
=
S_PROFILE_RETURN_GET
...
...
@@ -218,7 +220,9 @@ S_LANDING_PAGE_CREATE = {
},
"
group_image_link
"
:
{
"
type
"
:
"
string
"
},
"
primary_image_file
"
:
{
"
type
"
:
"
string
"
},
"
primary_image_file_write_date
"
:
{
"
type
"
:
"
string
"
},
"
secondary_image_file
"
:
{
"
type
"
:
"
string
"
},
"
secondary_image_file_write_date
"
:
{
"
type
"
:
"
string
"
},
"
short_description
"
:
{
"
type
"
:
"
string
"
},
"
long_description
"
:
{
"
type
"
:
"
string
"
},
"
why_become_cooperator
"
:
{
"
type
"
:
"
string
"
},
...
...
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