Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to automate from Approvals to Journal Entry/Bills

Naroči se

Get notified when there's activity on this post

This question has been flagged
accountingapprovalautomation
2 Odgovori
126 Prikazi
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
Opusti
John Chris Aganan
Avtor

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
Best Answer
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
Opusti
Avatar
Redian Software Pvt Ltd
Best Answer

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Unable to Use invoice_currency_rate in Automations – AttributeError in Odoo Online Solved
accounting automation
Avatar
1
jul. 25
1527
Automatic Accounting: Stock Input/Output Account Solved
stock accounting automation
Avatar
Avatar
1
feb. 25
2809
Internal Transfer (Bank Account to Credit Card) Reconciliation Model
accounting reconciliation automation
Avatar
Avatar
1
maj 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
sep. 24
5335
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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