Skip to content

Commit

Permalink
fix: sales and purchase mapping has to be validated
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninad1306 committed Aug 2, 2024
1 parent 80ca8bf commit 5e51de2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
SUBCONTRACTING_ORDER_RECEIPT_FIELD_MAP = {"total_taxable_value": "total"}


def after_mapping(doc, method, source_doc):
def after_mapping_subcontracting_order(doc, method, source_doc):
if source_doc.doctype != "Purchase Order":
return

Expand Down Expand Up @@ -67,6 +67,14 @@ def after_mapping(doc, method, source_doc):
item.item_tax_template = out.get("item_tax_template")


def after_mapping_stock_entry(doc, method, source_doc):
if source_doc.doctype == "Subcontracting Order":
return

doc.taxes_and_charges = ""
doc.taxes = []


def set_taxes(doc):
accounts = get_gst_accounts_by_type(doc.company, "Output", throw=False)
if not accounts:
Expand All @@ -84,7 +92,6 @@ def set_taxes(doc):
.where(sales.account_head == accounts.get("igst_account"))
.where(sales_template.disabled == 0)
.orderby(sales_template.is_default, order=Order.desc)
.limit(1)
.run(pluck=True)
)[0]

Expand Down
3 changes: 2 additions & 1 deletion india_compliance/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,11 @@
"Stock Entry": {
"onload": "india_compliance.gst_india.overrides.subcontracting_transaction.onload",
"validate": "india_compliance.gst_india.overrides.subcontracting_transaction.validate",
"after_mapping": "india_compliance.gst_india.overrides.subcontracting_transaction.after_mapping_stock_entry",
},
"Subcontracting Order": {
"validate": "india_compliance.gst_india.overrides.subcontracting_transaction.validate",
"after_mapping": "india_compliance.gst_india.overrides.subcontracting_transaction.after_mapping",
"after_mapping": "india_compliance.gst_india.overrides.subcontracting_transaction.after_mapping_subcontracting_order",
},
"Subcontracting Receipt": {
"onload": "india_compliance.gst_india.overrides.subcontracting_transaction.onload",
Expand Down

0 comments on commit 5e51de2

Please sign in to comment.