Skip to content
Snippets Groups Projects
Commit 1182e545 authored by Hervé Silvant - CGScop's avatar Hervé Silvant - CGScop
Browse files

Ajout des cotisations PACA dans la vue synthétique des cotisations

parent 27d9914f
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"cgscop_account", "cgscop_account",
"cgscop_liasse_fiscale", "cgscop_liasse_fiscale",
"cgscop_partner", "cgscop_partner",
"cgscop_cotisation_paca",
"lefilament_sales", "lefilament_sales",
], ],
"data": [ "data": [
......
...@@ -50,6 +50,61 @@ class ScopContributionReport(models.Model): ...@@ -50,6 +50,61 @@ class ScopContributionReport(models.Model):
], ],
} }
# ------------------------------------------------------
# Sub Query PACA
# ------------------------------------------------------
def _select_paca(self):
type_coti_ur = self.env.ref("cgscop_partner.riga_14399").id
select_str = """
SELECT
'odoo' as source,
CAST(i.annee AS VARCHAR),
%d AS type_contribution_id,
i.partner_id,
SUM(i.mt_coti) AS amount_called,
SUM(i.mt_paid) AS amount_paid,
SUM(i.mt_coti - i.mt_paid) AS amount_due
""" % (
type_coti_ur,
)
return select_str
def _from_paca(self):
from_str = """
FROM
scop_cotisation_paca i
"""
return from_str
def _where_paca(self):
where_str = """
WHERE
i.partner_id IS NOT NULL
"""
return where_str
def _groupby_paca(self):
groupby_str = """
GROUP BY
i.annee,
i.partner_id
"""
return groupby_str
def _query_paca(self):
query = "(%s %s %s %s)" % (
self._select_paca(),
self._from_paca(),
self._where_paca(),
self._groupby_paca(),
)
return query
def _subquerypaca(self):
return self._query_paca()
# ------------------------------------------------------ # ------------------------------------------------------
# Sub Query # Sub Query
# ------------------------------------------------------ # ------------------------------------------------------
...@@ -137,6 +192,8 @@ class ScopContributionReport(models.Model): ...@@ -137,6 +192,8 @@ class ScopContributionReport(models.Model):
query = ( query = (
self._select() self._select()
+ self._subquery() + self._subquery()
+" UNION ALL "
+ self._subquerypaca()
+ ") c " + ") c "
+ self._query_groupby() + self._query_groupby()
+ self._query_order() + self._query_order()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment