Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 2fe48f137d26ea4d31533d8bd6e6f6142405eb61
  • 14.0 par défaut
  • 12.0 protégée
  • 13.0
4 résultats

__init__.py

Blame
  • account_journal_dashboard.py 1,27 Kio
    # Copyright 2022 Le Filament (<http://www.le-filament.com>)
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    from odoo import api, models
    
    
    class AccountJournal(models.Model):
        _inherit = "account.journal"
    
        def _get_draft_bills_query(self):
            """
            Surcharger pour prendre amount_untaxed_signed (Stored=True) et non
            amount_untaxed_invoice_signed (pas Stored).
            Ce qui permet d'afficher les sommes lors de la regroupement
            """
            return (
                """
                SELECT
                    state,
                    amount_untaxed_signed AS amount_total,
                    inv.currency_id AS currency,
                    inv.type,
                    inv.date_invoice,
                    inv.company_id
                FROM account_invoice inv
                WHERE journal_id = %(journal_id)s AND state = 'draft';""",
                {"journal_id": self.id},
            )
    
        @api.multi
        def open_action(self):
            """
            Surcharge la fonction parente pour modifier le contexte de
            l'action sur les factures clients
            """
            action = super(AccountJournal, self).open_action()
            if action["xml_id"] == "account.action_invoice_tree1":
                action["context"].update({"search_default_this_year": 1})
            return action