chore: fix patch
This commit is contained in:
parent
153675e52a
commit
f6a61b999f
@ -1,26 +1,29 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import nowdate
|
from frappe.utils import nowdate
|
||||||
|
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import FiscalYearError, get_fiscal_year
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
# Only do for current fiscal year, no need to repost for all years
|
# Only do for current fiscal year, no need to repost for all years
|
||||||
for company in frappe.get_all("Company"):
|
for company in frappe.get_all("Company"):
|
||||||
fiscal_year_details = get_fiscal_year(date=nowdate(), company=company.name, as_dict=True)
|
try:
|
||||||
|
fiscal_year_details = get_fiscal_year(date=nowdate(), company=company.name, as_dict=True)
|
||||||
|
|
||||||
purchase_invoice = frappe.qb.DocType("Purchase Invoice")
|
purchase_invoice = frappe.qb.DocType("Purchase Invoice")
|
||||||
|
|
||||||
frappe.qb.update(purchase_invoice).set(
|
frappe.qb.update(purchase_invoice).set(
|
||||||
purchase_invoice.tax_withholding_net_total, purchase_invoice.net_total
|
purchase_invoice.tax_withholding_net_total, purchase_invoice.net_total
|
||||||
).set(
|
).set(
|
||||||
purchase_invoice.base_tax_withholding_net_total, purchase_invoice.base_net_total
|
purchase_invoice.base_tax_withholding_net_total, purchase_invoice.base_net_total
|
||||||
).where(
|
).where(
|
||||||
purchase_invoice.company == company.name
|
purchase_invoice.company == company.name
|
||||||
).where(
|
).where(
|
||||||
purchase_invoice.apply_tds == 1
|
purchase_invoice.apply_tds == 1
|
||||||
).where(
|
).where(
|
||||||
purchase_invoice.posting_date >= fiscal_year_details.year_start_date
|
purchase_invoice.posting_date >= fiscal_year_details.year_start_date
|
||||||
).where(
|
).where(
|
||||||
purchase_invoice.docstatus == 1
|
purchase_invoice.docstatus == 1
|
||||||
).run()
|
).run()
|
||||||
|
except FiscalYearError:
|
||||||
|
pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user