Skip to content

Commit

Permalink
fix: populate item tax template when mapping subcontracting order
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninad1306 committed Aug 2, 2024
1 parent 29de938 commit 875f09b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions india_compliance/gst_india/overrides/subcontracting_transaction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import frappe
from frappe import _, bold
from frappe.contacts.doctype.address.address import get_address_display
from erpnext.stock.get_item_details import _get_item_tax_template

from india_compliance.gst_india.overrides.sales_invoice import (
update_dashboard_with_gst_logs,
Expand Down Expand Up @@ -37,6 +38,30 @@ def after_mapping(doc, method, source_doc):
return

set_taxes(doc)
set_item_tax_template(doc, source_doc.as_dict())


def set_item_tax_template(doc, args):
args["tax_category"] = frappe.db.get_value(
"Purchase Taxes and Charges Template", args.taxes_and_charges, "tax_category"
)

for item in doc.items:
item_doc = frappe.get_cached_doc("Item", item.item_code)

item_tax_template = None
if item_doc.taxes:
item_tax_template = _get_item_tax_template(args, item_doc.taxes)

if not item_tax_template:
item_group = item_doc.item_group

while item_group and not item_tax_template:
item_group_doc = frappe.get_cached_doc("Item Group", item_group)
item_tax_template = _get_item_tax_template(args, item_group_doc.taxes)
item_group = item_group_doc.parent_item_group

item.item_tax_template = item_tax_template


def set_taxes(doc):
Expand Down

0 comments on commit 875f09b

Please sign in to comment.