Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
festa_dashboard
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
Festa
festa_dashboard
Commits
e9cc0088
Commit
e9cc0088
authored
4 months ago
by
Benjamin - Le Filament
Browse files
Options
Downloads
Patches
Plain Diff
[UPD] functions description
parent
0092bb05
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/hall_contract.py
+19
-22
19 additions, 22 deletions
models/hall_contract.py
with
19 additions
and
22 deletions
models/hall_contract.py
+
19
−
22
View file @
e9cc0088
...
...
@@ -27,6 +27,9 @@ class HallContract(models.Model):
# Action buttons
# ------------------------------------------------------
def
show_overview
(
self
):
"""
Affiche le tableau de bors pour un contrat
"""
self
.
ensure_one
()
action
=
self
.
env
[
"
ir.actions.actions
"
].
_for_xml_id
(
"
festa_dashboard.hall_contract_overview_action
"
...
...
@@ -41,6 +44,9 @@ class HallContract(models.Model):
@api.model
def
update_cashpad_values
(
self
):
"""
Fonction de mise à jour de chargement des ventes depuis le Dashboard
"""
self
.
search
([(
"
cashpad_id
"
,
"
!=
"
,
False
)]).
get_sales
()
# ------------------------------------------------------
...
...
@@ -48,6 +54,7 @@ class HallContract(models.Model):
# ------------------------------------------------------
def
is_running
(
self
,
date_filter
):
"""
Fonction permettant de calculer si un contrat est en cours à une date donnée
:param date date_filter: date de référence
"""
self
.
ensure_one
()
...
...
@@ -59,6 +66,9 @@ class HallContract(models.Model):
return
False
def
get_overview
(
self
):
"""
Retourne les données pour la vue Qweb du Dashboard
"""
job_ids
=
(
self
.
env
[
"
queue.job
"
]
.
sudo
()
...
...
@@ -99,26 +109,6 @@ class HallContract(models.Model):
"
passerby_ids
"
:
passerby_ids
,
}
#
#
# {
# "visitor": sum(visitor_ids.filtered(
# lambda f: f.date >= yesterday).mapped("count")),
# "passerby": sum(passerby_ids.filtered(
# lambda f: f.date >= yesterday).mapped("count")),
# },
# "this_month": {
# "visitor": sum(visitor_ids.filtered(
# lambda f: f.date >= start_month).mapped("count")),
# "passerby": sum(passerby_ids.filtered(
# lambda f: f.date >= start_month).mapped("count")),
# },
# "this_year": {
# "visitor": sum(visitor_ids.mapped("count")),
# "passerby": sum(passerby_ids.mapped("count")),
# },
# }
def
get_overview_sales
(
self
):
"""
Données de la vue QWEB des indicateurs CA
...
...
@@ -176,8 +166,10 @@ class HallContract(models.Model):
def
_get_target
(
self
,
year
,
month
=
None
):
"""
:param int year:
:param int month:
Retourne le CA cible pour une année ou un mois donné
:param int year: année
:param int month: mois
@returns monetary target: montant cible
"""
granularity
=
"
month
"
if
month
else
"
year
"
month
=
month
if
month
else
1
...
...
@@ -193,6 +185,11 @@ class HallContract(models.Model):
return
sum
(
target_ids
.
mapped
(
"
amount_untaxed_target
"
))
def
_get_revenue_detail
(
self
):
"""
Retourne le détail du CA pour un contrat pour permettre l
'
affichage
détaillé par mois
Retourne False si il y a plus d
'
un contrat dans self
"""
if
len
(
self
)
!=
1
:
return
False
...
...
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