mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 13:49:13 +00:00
feat: Introduce tax withholding entry
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
import frappe
|
||||
from frappe.utils import nowdate
|
||||
|
||||
from erpnext.accounts.utils import FiscalYearError, get_fiscal_year
|
||||
|
||||
|
||||
def execute():
|
||||
# Only do for current fiscal year, no need to repost for all years
|
||||
for company in frappe.get_all("Company"):
|
||||
try:
|
||||
fiscal_year_details = get_fiscal_year(date=nowdate(), company=company.name, as_dict=True)
|
||||
|
||||
purchase_invoice = frappe.qb.DocType("Purchase Invoice")
|
||||
|
||||
frappe.qb.update(purchase_invoice).set(
|
||||
purchase_invoice.tax_withholding_net_total, purchase_invoice.net_total
|
||||
).set(purchase_invoice.base_tax_withholding_net_total, purchase_invoice.base_net_total).where(
|
||||
purchase_invoice.company == company.name
|
||||
).where(purchase_invoice.apply_tds == 1).where(
|
||||
purchase_invoice.posting_date >= fiscal_year_details.year_start_date
|
||||
).where(purchase_invoice.docstatus == 1).run()
|
||||
|
||||
purchase_order = frappe.qb.DocType("Purchase Order")
|
||||
|
||||
frappe.qb.update(purchase_order).set(
|
||||
purchase_order.tax_withholding_net_total, purchase_order.net_total
|
||||
).set(purchase_order.base_tax_withholding_net_total, purchase_order.base_net_total).where(
|
||||
purchase_order.company == company.name
|
||||
).where(purchase_order.apply_tds == 1).where(
|
||||
purchase_order.transaction_date >= fiscal_year_details.year_start_date
|
||||
).where(purchase_order.docstatus == 1).run()
|
||||
except FiscalYearError:
|
||||
pass
|
||||
1289
erpnext/patches/v16_0/migrate_tax_withholding_data.py
Normal file
1289
erpnext/patches/v16_0/migrate_tax_withholding_data.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
import frappe
|
||||
from frappe.query_builder import DocType
|
||||
|
||||
|
||||
def execute():
|
||||
if not frappe.db.has_column("Payment Entry", "apply_tax_withholding_amount"):
|
||||
return
|
||||
|
||||
pe = DocType("Payment Entry")
|
||||
(frappe.qb.update(pe).set(pe.apply_tds, pe.apply_tax_withholding_amount)).run()
|
||||
Reference in New Issue
Block a user