Skip to content

Commit

Permalink
fix: uom as per gst (#2019)
Browse files Browse the repository at this point in the history
* fix: uom as per gst

* chore: refactor and wrap original function

---------

(cherry picked from commit 7535221)
  • Loading branch information
priyanshshah2442 authored and mergify[bot] committed Apr 11, 2024
1 parent b27b18f commit 8cdf609
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,11 @@ def can_enable_api(settings):
return settings.api_secret or frappe.conf.ic_api_secret


def get_full_gst_uom(uom, settings=None):
uom = get_gst_uom(uom, settings=settings)
return f"{uom}-{UOM_MAP.get(uom)}"


def get_gst_uom(uom, settings=None):
"""Returns the GST UOM from ERPNext UOM"""
settings = settings or frappe.get_cached_doc("GST Settings")
Expand Down
5 changes: 5 additions & 0 deletions india_compliance/gst_india/utils/gstr/gstr_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from frappe.query_builder.functions import Date, IfNull, Sum
from frappe.utils import getdate

from india_compliance.gst_india.utils import get_full_gst_uom

B2C_LIMIT = 2_50_000

# TODO: Enum for Invoice Type
Expand Down Expand Up @@ -453,9 +455,12 @@ def __init__(self, filters=None):
super().__init__(filters)

def process_invoices(self, invoices):
settings = frappe.get_cached_doc("GST Settings")

for invoice in invoices:
self.invoice_conditions = {}
self.assign_categories(invoice)
invoice["uom"] = get_full_gst_uom(invoice.get("uom"), settings)

def assign_categories(self, invoice):

Expand Down

0 comments on commit 8cdf609

Please sign in to comment.