Skip to content
Extraits de code Groupes Projets
Valider 630f529e rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[CLN] remove python part moved to JS

parent 19a6b50a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -159,182 +159,6 @@ class LeFilamentTdb(models.Model): ...@@ -159,182 +159,6 @@ class LeFilamentTdb(models.Model):
def _format_monetary(amount): def _format_monetary(amount):
return f"{amount:,}".replace(",", " ") + "" return f"{amount:,}".replace(",", " ") + ""
# @api.model
# def retrieve_datas_dashboard(self):
# # Get fiscal years
# fiscal_date = date(
# date.today().year,
# int(self.env.company.fiscalyear_last_month),
# int(self.env.company.fiscalyear_last_day),
# )
# if date.today() > fiscal_date:
# fiscal_year = fiscal_date
# fiscal_year_next = fiscal_date + relativedelta(years=1)
# else:
# fiscal_year = fiscal_date - relativedelta(years=1)
# fiscal_year_next = fiscal_date
#
# # Invoices
# invoiced = (
# self.env["account.move"]
# .read_group(
# [
# ("move_type", "in", ("out_invoice", "out_refund")),
# ("state", "=", "posted"),
# ("invoice_date", ">", fiscal_year),
# ("invoice_date", "<=", fiscal_year_next),
# ],
# ["amount_untaxed_signed:sum"],
# [],
# )[0]
# .get("amount_untaxed_signed", 0.0)
# )
# # Orders
# ordered = (
# self.env["sale.order.line"]
# .read_group(
# [
# ("invoice_status", "=", "to invoice"),
# ],
# ["price_subtotal:sum"],
# [],
# )[0]
# .get("price_subtotal", 0.0)
# )
# # Leads
# pipe_win = (
# self.env["crm.lead"]
# .read_group(
# [
# ("probability", "=", 100),
# "|",
# ("date_deadline", "<=", fiscal_year_next),
# ("date_deadline", "=", False),
# ],
# ["prorated_revenue:sum"],
# [],
# )[0]
# .get("prorated_revenue", 0.0)
# )
# pipe = (
# self.env["crm.lead"]
# .read_group(
# [
# "|",
# ("date_deadline", "<=", fiscal_year_next),
# ("date_deadline", "=", False),
# ],
# ["prorated_revenue:sum"],
# [],
# )[0]
# .get("prorated_revenue", 0.0)
# )
#
# target = self.env.company.ca_target
# invoiced_percentage = round(invoiced / target * 100) if target else 0
# ordered_percentage = round(ordered / target * 100) if target else 0
# toinvoice = target - invoiced
# toinvoice_percentage = round(toinvoice / target * 100) if target else 0
# pipe_win_percentage = round(pipe_win / target * 100) if target else 0
# ongoing = invoiced + ordered + pipe_win
# ongoing_percentage = (
# round((invoiced + ordered + pipe_win) / target * 100) if target else 0
# )
#
# to_get = (
# self.env["account.move"]
# .read_group(
# [
# ("move_type", "in", ("out_invoice", "out_refund")),
# ("state", "=", "posted"),
# ("payment_state", "in", ["not_paid", "partial", "in_payment"]),
# ],
# ["amount_untaxed_signed:sum"],
# [],
# )[0]
# .get("amount_untaxed_signed", 0.0)
# )
# to_pay = (
# self.env["account.move"]
# .read_group(
# [
# ("move_type", "in", ("in_invoice", "in_refund")),
# ("state", "=", "posted"),
# ("payment_state", "in", ["not_paid", "partial", "in_payment"]),
# ],
# ["amount_untaxed_signed:sum"],
# [],
# )[0]
# .get("amount_untaxed_signed", 0.0)
# )
#
# date_maj = (
# self.env["account.bank.statement.line"]
# .search([], order="date desc", limit=1)
# .date.strftime("%d/%m/%Y")
# )
# available_cash = (
# self.env["account.bank.statement.line"]
# .read_group([], ["amount:sum"], [])[0]
# .get("amount", 0.0)
# )
# cash_by_bank = self.env["account.bank.statement.line"].read_group(
# domain=[],
# fields=["journal_id", "amount"],
# groupby=["journal_id"],
# orderby="journal_id",
# )
#
# cash_in = (
# self.env["account.bank.statement.line"]
# .read_group(
# [
# ("amount", ">", 0),
# ("date", ">", fiscal_year),
# ],
# ["amount:sum"],
# [],
# )[0]
# .get("amount", 0.0)
# )
# cash_out = (
# self.env["account.bank.statement.line"]
# .read_group(
# [
# ("amount", "<", 0),
# ("date", ">", fiscal_year),
# ],
# ["amount:sum"],
# [],
# )[0]
# .get("amount", 0.0)
# )
#
# variation = cash_in + cash_out
#
# return {
# "invoiced": self._format_monetary(invoiced),
# "toinvoice": self._format_monetary(toinvoice),
# "ordered": self._format_monetary(ordered),
# "pipe_win": self._format_monetary(pipe_win),
# "pipe": self._format_monetary(pipe),
# "ongoing": self._format_monetary(ongoing),
# "target": self._format_monetary(target),
# "invoiced_percentage": invoiced_percentage,
# "toinvoice_percentage": toinvoice_percentage,
# "ordered_percentage": ordered_percentage,
# "pipe_win_percentage": pipe_win_percentage,
# "ongoing_percentage": ongoing_percentage,
# "date_maj": date_maj,
# "available_cash": self._format_monetary(available_cash),
# "cash_by_bank": cash_by_bank,
# "to_get": self._format_monetary(to_get),
# "to_pay": self._format_monetary(to_pay),
# "variation": self._format_monetary(variation),
# "cash_in": self._format_monetary(cash_in),
# "cash_out": self._format_monetary(cash_out),
# }
@api.model @api.model
def dashboard_detail_values(self, date_start=None, date_end=None): def dashboard_detail_values(self, date_start=None, date_end=None):
customer = self._customer_detail(date_start, date_end) customer = self._customer_detail(date_start, date_end)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter