Skip to content

Commit

Permalink
Feat: implemented the autopopulation of tax templates according to et…
Browse files Browse the repository at this point in the history
…ims taxation type field.
  • Loading branch information
GichanaMayaka committed May 3, 2024
1 parent 4f73e09 commit b8d5739
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kenya_compliance/kenya_compliance/overrides/server/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,19 @@ def validate(doc: Document, method: str) -> None:
item_code = f"{doc.custom_etims_country_of_origin_code}{doc.custom_product_type}{doc.custom_packaging_unit_code}{doc.custom_unit_of_quantity_code}{padded_series}"

doc.custom_item_code_etims = item_code

if doc.custom_taxation_type:
relevant_tax_templates = frappe.get_all(
"Item Tax Template",
["*"],
{
"name": ["like", "%Kenya%"],
"custom_etims_taxation_type": doc.custom_taxation_type,
},
)

if relevant_tax_templates:
doc.set("taxes", [])
for template in relevant_tax_templates:
doc.append("taxes", {"item_tax_template": template.name})

0 comments on commit b8d5739

Please sign in to comment.