Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

How to automate from Approvals to Journal Entry/Bills

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
accountingapprovalautomation
2 Risposte
125 Visualizzazioni
Avatar
John Chris Aganan

Hello everyone, I would like to ask for your help in implementing a cash advance sort of system where an employee can request via approvals module a cash advance. Then when it gets approved it will generate a journal entry and/or a bill for the accounting department.

I tried automation in odoo studio but no journal entry is being created and bills is also not created.  

I hope someone can help. Thank you!

0
Avatar
Abbandona
John Chris Aganan
Autore

Hello, Thank you for this. But this is where I get blocked by the problem, nothing is created in the journal entries even though I followed your instructions.

I hope you can help me further, Thank you!

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Risposta migliore
Hi,
To implement a cash-advance workflow in Odoo, the idea is to extend the Approvals module so that it can communicate with the Accounting module. The process begins by creating a dedicated Approval Category specifically for cash-advance requests. This category defines the structure of the request, including fields for the employee, the requested amount, and the purpose of the advance. Once this category is in place, employees submit their cash-advance requests through the standard approval.request model.

When the request reaches approval, you then override the action_approve() method of the approval request. Inside this method, you can add custom logic to automatically generate an accounting journal entry that reflects the cash advance granted to the employee. This ensures that the accounting team does not have to manually create any entries; everything is generated automatically once the manager approves the request. This complete workflow allows you to manage cash advances smoothly and consistently within Odoo.

Try the following steps.

1- Create an Approval Type
* This defines a new approval category called “Cash Advance Request”.

data/approval_category_data.xml

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <record id="approval_category_cash_advance" model="approval.category">
        <field name="name">Cash Advance Request</field>
        <field name="description">Approval workflow used to request employee cash advances.</field>
        <field name="requires_approver">True</field>
        <field name="has_amount">True</field>
        <field name="approver_ids" eval="[(0,0,{'user_id': ref('base.user_admin')})]"/>
    </record>
</odoo>

2- Extend Approval Request to Add Cash Advance Fields
* You may want to store fields such as:
        - employee requesting the advance
        - amount requested
        - purpose
        - journal entry created

models/cash_advance_request.py


from odoo import models, fields, api
from odoo.exceptions import UserError


class ApprovalRequest(models.Model):
    _inherit = "approval.request"

    cash_advance_amount = fields.Monetary(
        string="Cash Advance Amount",
        currency_field="currency_id",
    )

    currency_id = fields.Many2one(
        "res.currency",
        default=lambda self: self.env.company.currency_id.id,
    )

    journal_entry_id = fields.Many2one(
        "account.move",
        string="Journal Entry",
        readonly=True,
    )

    def _is_cash_advance(self):
        """Check if the request belongs to our custom category"""
        return self.category_id == self.env.ref(
            "cash_advance.approval_category_cash_advance"
        )


3- Override action_approve() to Create a Journal Entry
* When a Cash Advance Request is approved:
          - Create a journal entry
          - Debit → Employee Receivable
          - Credit → Cash/Bank
          - Link the JE back to the request

models/cash_advance_request.py (continued)

    def action_approve(self):
        """Extend the approval workflow to create a journal entry."""
        res = super().action_approve()

        for request in self:
            if not request._is_cash_advance():
                continue

            if request.journal_entry_id:
                continue  # Avoid duplicates

            employee = request.request_owner_id.employee_id
            if not employee:
                raise UserError("No employee linked to the requester.")

            amount = request.cash_advance_amount
            if amount <= 0:
                raise UserError("Cash advance amount must be greater than zero.")

            # Journal with type 'cash' or 'bank'
            journal = self.env['account.journal'].search(
                [('type', 'in', ['cash', 'bank'])],
                limit=1
            )
            if not journal:
                raise UserError("Please configure a Cash or Bank Journal.")

            # Use employee’s receivable account
            receivable_account = employee.address_home_id.property_account_receivable_id
            if not receivable_account:
                raise UserError("Employee has no receivable account configured.")

            # Construct the journal entry
            move_vals = {
                'move_type': 'entry',
                'journal_id': journal.id,
                'ref': f"Cash Advance - {employee.name}",
                'line_ids': [
                    # Debit employee receivable
                    (0, 0, {
                        'name': "Cash Advance to Employee",
                        'account_id': receivable_account.id,
                        'debit': amount,
                    }),
                    # Credit cash/bank
                    (0, 0, {
                        'name': "Cash Advance Disbursement",
                        'account_id': journal.default_account_id.id,
                        'credit': amount,
                    }),
                ]
            }

            move = self.env["account.move"].create(move_vals)
            move.action_post()

            # Link JE to request

            request.journal_entry_id = move.id


        return res

Hope it helps

0
Avatar
Abbandona
Avatar
Redian Software Pvt Ltd
Risposta migliore

1. Create the Approval Type

  • Go to Approvals → Configuration → Approval Types → Create

  • Name: Cash Advance Request

  • Add fields: Employee, Amount, Purpose

  • Set approvers (Manager / Finance)

2. Create an Automated Action

Go to:

Settings → Technical → Automation → Automated Actions → Create

Set:

  • Model: Approvals Request

  • Trigger: On Update

  • Condition: state == 'approved'

  • Action: Execute Python Code

3. Paste This Code (for Journal Entry)

employee = record.employee_id
amount = record.amount or 0.0

journal = env['account.journal'].search([('type', '=', 'cash')], limit=1)
advance_account = env['account.account'].search([('code', '=', '141000')], limit=1)
cash_account = env['account.account'].search([('code', '=', '100000')], limit=1)

move_vals = {
    'journal_id': journal.id,
    'ref': f"Cash Advance - {employee.name}",
    'line_ids': [
        (0, 0, {'account_id': advance_account.id, 'name': 'Advance', 'debit': amount}),
        (0, 0, {'account_id': cash_account.id, 'name': 'Cash Out', 'credit': amount}),
    ]
}

move = env['account.move'].create(move_vals)
move.action_post()

4. Test

  • Submit a cash advance request

  • Approve it

  • Check Accounting → Journal Entries

0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Unable to Use invoice_currency_rate in Automations – AttributeError in Odoo Online Risolto
accounting automation
Avatar
1
lug 25
1527
Automatic Accounting: Stock Input/Output Account Risolto
stock accounting automation
Avatar
Avatar
1
feb 25
2809
Internal Transfer (Bank Account to Credit Card) Reconciliation Model
accounting reconciliation automation
Avatar
Avatar
1
mag 24
2083
Auto reconcile imported invoices/bills with imported payments/bank statements using a scheduled action with no user intervention
accounting reconciliation automation
Avatar
0
nov 23
4247
Odoo 17: how to create records using Automation Rules
approval automation internal-transfer v17
Avatar
Avatar
1
set 24
5335
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now