Skip to content
Snippets Groups Projects
Commit e9cc0088 authored by Benjamin - Le Filament's avatar Benjamin - Le Filament
Browse files

[UPD] functions description

parent 0092bb05
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment