Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to automate from Approvals to Journal Entry/Bills

Odebírat

Get notified when there's activity on this post

This question has been flagged
accountingapprovalautomation
2 Odpovědi
212 Zobrazení
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
Zrušit
John Chris Aganan
Autor

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
Nejlepší odpověď
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
Zrušit
Avatar
Redian Software Pvt Ltd
Nejlepší odpověď

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
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Unable to Use invoice_currency_rate in Automations – AttributeError in Odoo Online Vyřešeno
accounting automation
Avatar
1
čvc 25
1545
Automatic Accounting: Stock Input/Output Account Vyřešeno
stock accounting automation
Avatar
Avatar
1
úno 25
2836
Internal Transfer (Bank Account to Credit Card) Reconciliation Model
accounting reconciliation automation
Avatar
Avatar
1
kvě 24
2100
Auto reconcile imported invoices/bills with imported payments/bank statements using a scheduled action with no user intervention
accounting reconciliation automation
Avatar
0
lis 23
4270
Odoo 17: how to create records using Automation Rules
approval automation internal-transfer v17
Avatar
Avatar
1
zář 24
5396
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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