fix: fetch item tax template from item group when creating item (#54405)

This commit is contained in:
Pandiyan P
2026-04-20 11:58:16 +05:30
committed by GitHub
parent 1ccbc9f621
commit ffa0268a57

View File

@@ -791,6 +791,20 @@ class Item(Document):
{"company": defaults.get("company"), "default_warehouse": defaults.default_warehouse}, {"company": defaults.get("company"), "default_warehouse": defaults.default_warehouse},
) )
item_group = frappe.get_cached_doc("Item Group", self.item_group)
if not self.taxes and item_group.taxes:
for tax in item_group.taxes:
self.append(
"taxes",
{
"item_tax_template": tax.item_tax_template,
"tax_category": tax.tax_category,
"valid_from": tax.valid_from,
"minimum_net_rate": tax.minimum_net_rate,
"maximum_net_rate": tax.maximum_net_rate,
},
)
def update_variants(self): def update_variants(self):
if self.flags.dont_update_variants or frappe.db.get_single_value( if self.flags.dont_update_variants or frappe.db.get_single_value(
"Item Variant Settings", "do_not_update_variants" "Item Variant Settings", "do_not_update_variants"