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
44abc281
Commit
44abc281
authored
Jun 10, 2024
by
François COLOMBIER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout d'un module gérant les requêtes pour les exports, dont en premier, pour le capital social
parent
32139ab4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
0 deletions
+83
-0
__init__.py
lacagette_addons/lacagette_exports/__init__.py
+4
-0
__openerp__.py
lacagette_addons/lacagette_exports/__openerp__.py
+27
-0
__init__.py
lacagette_addons/lacagette_exports/models/__init__.py
+3
-0
members.py
lacagette_addons/lacagette_exports/models/members.py
+49
-0
No files found.
lacagette_addons/lacagette_exports/__init__.py
0 → 100644
View file @
44abc281
# -*- coding: utf-8 -*-
from
.
import
models
\ No newline at end of file
lacagette_addons/lacagette_exports/__openerp__.py
0 → 100644
View file @
44abc281
# -*- coding: utf-8 -*-
{
'name'
:
"La Cagette Exports"
,
'summary'
:
"""
Implements methods to make SQL queries for exports purposes
"""
,
'description'
:
"""
"""
,
'author'
:
"fracolo"
,
'website'
:
"https://lacagette-coop.fr"
,
'category'
:
'Uncategorized'
,
'version'
:
'0.0.1'
,
# any module necessary for this one to work correctly
'depends'
:
[
'base'
],
# always loaded
'data'
:
[
],
'installable'
:
True
,
}
lacagette_addons/lacagette_exports/models/__init__.py
0 → 100644
View file @
44abc281
# -*- coding: utf-8 -*-
from
.
import
members
lacagette_addons/lacagette_exports/models/members.py
0 → 100644
View file @
44abc281
# -*- coding: utf-8 -*-
from
openerp
import
models
,
fields
,
api
import
logging
import
datetime
_logger
=
logging
.
getLogger
(
__name__
)
class
LacagetteExports
(
models
.
Model
):
_name
=
"lacagette.exports"
@api.model
def
get_members_capital_at_date
(
self
,
params
=
{}):
# _logger.info("Params reçus = %s", str(params))
# Params reçus = {'date': '2023-06-30', 'only_active': 0}
res
=
{}
try
:
active_restriction
=
''
if
'only_active'
in
params
and
params
[
'only_active'
]
==
1
:
active_restriction
=
"""
AND
partner_id IN (SELECT id FROM res_partner WHERE active = true)"""
sql
=
"""
SELECT
(SELECT display_name FROM res_partner WHERE id = partner_id) as membre,
capital_detenu
FROM
(
SELECT SUM(amount_total_signed) as capital_detenu, partner_id
FROM account_invoice
WHERE
is_capital_fundraising = true
AND
create_date <= '
%
s'
GROUP by partner_id
ORDER BY partner_id ASC
) as req_capital
WHERE
capital_detenu > 0
%
s
ORDER BY partner_id ASC;
"""
%
(
params
[
'date'
],
active_restriction
)
_logger
.
info
(
"Requete =
%
s"
,
sql
)
self
.
env
.
cr
.
execute
(
sql
)
res
[
'data'
]
=
self
.
env
.
cr
.
dictfetchall
()
except
Exception
as
e
:
res
[
'error'
]
=
str
(
e
)
return
res
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