From 39d9cbc43d2dd3a8c76705228dca26ebdef977a8 Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Fri, 11 Oct 2019 10:43:50 +0530 Subject: [PATCH] fix(patch): use db_insert instead of save to escape validations (#19279) --- erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py b/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py index 9f4c445365..412f32030a 100644 --- a/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py +++ b/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py @@ -41,7 +41,9 @@ def execute(): item = frappe.get_doc("Item", item_code) item.set("taxes", []) item.append("taxes", {"item_tax_template": item_tax_template_name, "tax_category": ""}) - item.save() + frappe.db.sql("delete from `tabItem Tax` where parent=%s and parenttype='Item'", item_code) + for d in item.taxes: + d.db_insert() doctypes = [ 'Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice',