---
title: "Auto Withholding Tax Journal upon Purchase of Specific Non-Stock Items (Service Items)"
space: "Wiki"
url: "https://support.aakvatech.com/wiki/auto-withholding-tax-journal-upon-purchase-of-specific-non-stock-items-service-items"
updated: "2026-07-22"
---

<p>This user manual describes the functionality and use of the script that automates the creation of withholding tax journal entries in ERPNext for purchases of specific non-stock items (service items).</p>
<hr>
<h2 id="-overview-"><strong>Overview</strong></h2>
<p>The script automates the creation of journal entries for withholding tax based on the purchase of items with a defined withholding tax rate. It ensures compliance by linking the journal entry to the respective purchase invoice and accounts for multi-currency scenarios. This feature is particularly useful for businesses needing to manage withholding tax obligations efficiently.</p>
<hr>
<h2 id="-key-features-"><strong>Key Features</strong></h2>
<ol>
<li><p><strong>Automated Journal Entry Creation</strong>:</p>
<ul>
<li>Automatically generates a withholding tax journal entry for items with a specified withholding tax rate in a Purchase Invoice.</li>
<li>Ensures the journal entry includes both debit and credit transactions.</li>
</ul>
</li>
<li><p><strong>Validation and Configuration</strong>:</p>
<ul>
<li>Verifies that the withholding payable account is set up and is of the correct type (<code>Payable</code>).</li>
<li>Supports multi-currency scenarios by using the conversion rate for accurate calculations.</li>
</ul>
</li>
<li><p><strong>Integration with Purchase Invoice</strong>:</p>
<ul>
<li>Links the withholding tax journal entry directly to the corresponding Purchase Invoice for traceability.</li>
<li>Updates item records in the Purchase Invoice to indicate that the withholding tax journal entry has been created.</li>
</ul>
</li>
<li><p><strong>Customizable Behavior</strong>:</p>
<ul>
<li>Controlled by company-level settings (<code>auto_create_for_purchase_withholding</code> and <code>auto_submit_for_purchase_withholding</code>).</li>
<li>Allows for optional auto-submission of the generated journal entry.</li>
</ul>
</li>
<li><p><strong>User Notifications</strong>:</p>
<ul>
<li>Provides a clickable link to the created journal entry for user convenience.</li>
</ul>
</li>
</ol>
<hr>
<h2 id="-pre-requisites-"><strong>Pre-Requisites</strong></h2>
<ul>
<li><p><strong>Company Configuration</strong>:</p>
<ul>
<li>Ensure the &quot;Default Withholding Payable Account&quot; is set in the Company document.</li>
<li>The account type of the withholding payable account must be <code>Payable</code>.</li>
<li>Configure the settings:<ul>
<li><code>auto_create_for_purchase_withholding</code>: Enables/disables automatic journal entry creation.</li>
<li><code>auto_submit_for_purchase_withholding</code>: Enables/disables automatic submission of the journal entry.</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Item Setup</strong>:</p>
<ul>
<li>Items must have a <code>withholding_tax_rate</code> defined.</li>
</ul>
</li>
<li><p><strong>User Permissions</strong>:</p>
<ul>
<li>Appropriate permissions for journal entry creation and submission.</li>
</ul>
</li>
</ul>
<hr>
<h2 id="-step-by-step-usage-"><strong>Step-by-Step Usage</strong></h2>
<ol>
<li><p><strong>Create a Purchase Invoice</strong>:</p>
<ul>
<li>Enter details of the supplier and the purchased items.</li>
<li>Include items with a defined withholding tax rate.</li>
</ul>
</li>
<li><p><strong>Journal Entry Creation</strong>:</p>
<ul>
<li>Upon saving or submitting the Purchase Invoice, the script is triggered.</li>
<li>Validates the presence of the withholding payable account and its account type.</li>
</ul>
</li>
<li><p><strong>Journal Entry Details</strong>:</p>
<ul>
<li>A journal entry is created with:<ul>
<li>Debit entry to the supplier&#39;s account.</li>
<li>Credit entry to the withholding payable account.</li>
</ul>
</li>
<li>Uses the item’s net rate, quantity, and withholding tax rate for calculation.</li>
</ul>
</li>
<li><p><strong>Multi-Currency Support</strong>:</p>
<ul>
<li>If the invoice currency differs from the company’s default currency, the conversion rate is applied.</li>
</ul>
</li>
<li><p><strong>Notifications</strong>:</p>
<ul>
<li>After the journal entry is created, a message with a link to the entry is displayed.</li>
</ul>
</li>
<li><p><strong>View and Manage Journal Entries</strong>:</p>
<ul>
<li>Access the created journal entries via the link provided in the notification or from the Journal Entry list.</li>
</ul>
</li>
</ol>
<hr>
<h2 id="-script-customizations-"><strong>Script Customizations</strong></h2>
<ul>
<li><p><strong>Float Precision</strong>:</p>
<ul>
<li>Configurable via the &quot;float_precision&quot; system setting to control rounding accuracy.</li>
</ul>
</li>
<li><p><strong>Exchange Rate</strong>:</p>
<ul>
<li>Automatically fetched from the Purchase Invoice for multi-currency calculations.</li>
</ul>
</li>
<li><p><strong>Remarks in Journal Entry</strong>:</p>
<ul>
<li>User remarks in the journal entry include item code, Purchase Invoice reference, amount, and exchange rate for better traceability.</li>
</ul>
</li>
</ul>
<hr>
<h2 id="-troubleshooting-"><strong>Troubleshooting</strong></h2>
<h3 id="common-errors-and-resolutions">Common Errors and Resolutions</h3>
<ol>
<li><p><strong>Withholding Payable Account Not Configured</strong>:</p>
<ul>
<li>Ensure the &quot;Default Withholding Payable Account&quot; is set in the Company document.</li>
</ul>
</li>
<li><p><strong>Incorrect Account Type</strong>:</p>
<ul>
<li>Verify the withholding payable account is of type <code>Payable</code>.</li>
</ul>
</li>
<li><p><strong>Withholding Tax Rate Missing</strong>:</p>
<ul>
<li>Check that the <code>withholding_tax_rate</code> is defined for the item.</li>
</ul>
</li>
<li><p><strong>Permission Errors</strong>:</p>
<ul>
<li>Ensure the user has necessary permissions for journal entry creation and submission.</li>
</ul>
</li>
</ol>
<hr>
<h2 id="-user-roles-and-permissions-"><strong>User Roles and Permissions</strong></h2>
<ul>
<li><p><strong>Finance Manager</strong>:</p>
<ul>
<li>Oversees withholding tax configurations and journal entry approvals.</li>
</ul>
</li>
<li><p><strong>Purchase User</strong>:</p>
<ul>
<li>Creates Purchase Invoices with withholding tax applicable items.</li>
</ul>
</li>
<li><p><strong>System Administrator</strong>:</p>
<ul>
<li>Configures company settings and ensures the system runs as expected.</li>
</ul>
</li>
</ul>
<hr>
<h2 id="-key-notes-"><strong>Key Notes</strong></h2>
<ul>
<li>Journal entries are only created for items with a <code>withholding_tax_rate</code> greater than zero.</li>
<li>If the withholding tax journal entry is already created for an item (<code>csf_tz_wtax_jv_created = 1</code>), no duplicate entry is made.</li>
<li>The script ensures compliance by linking transactions, providing traceability, and adhering to financial regulations.</li>
</ul>
<hr>
<p>This functionality streamlines withholding tax management, enhances accuracy, and ensures compliance with financial practices.</p>
