Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

How to automate from Approvals to Journal Entry/Bills

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
accountingapprovalautomation
2 Trả lời
168 Lượt xem
Ảnh đại diện
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
Ảnh đại diện
Huỷ bỏ
John Chris Aganan
Tác giả

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!

Ảnh đại diện
Cybrosys Techno Solutions Pvt.Ltd
Câu trả lời hay nhất
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
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Redian Software Pvt Ltd
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
Unable to Use invoice_currency_rate in Automations – AttributeError in Odoo Online Đã xử lý
accounting automation
Ảnh đại diện
1
thg 7 25
1536
Automatic Accounting: Stock Input/Output Account Đã xử lý
stock accounting automation
Ảnh đại diện
Ảnh đại diện
1
thg 2 25
2818
Internal Transfer (Bank Account to Credit Card) Reconciliation Model
accounting reconciliation automation
Ảnh đại diện
Ảnh đại diện
1
thg 5 24
2094
Auto reconcile imported invoices/bills with imported payments/bank statements using a scheduled action with no user intervention
accounting reconciliation automation
Ảnh đại diện
0
thg 11 23
4258
Odoo 17: how to create records using Automation Rules
approval automation internal-transfer v17
Ảnh đại diện
Ảnh đại diện
1
thg 9 24
5360
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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