Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hsn summary calculation #333

Merged
merged 1 commit into from
Nov 14, 2022
Merged

Conversation

rtdany10
Copy link
Contributor

@rtdany10 rtdany10 commented Nov 10, 2022

Problem:
If you raise a GST invoice with the same item multiple times in the invoice with different UOMs, the report only shows data of 1 uom and skips the rest.

Also, if you add the same item twice in the invoice with different HSN Code(eg: Service items with same name and different HSN code), the report only shows data of either one.

Cause:
HSN wise Summary report grouped data in the SQL query by the following 4 parameters:

  1. Parent, ie, Sales Invoice ID
  2. HSN Code
  3. Item Code
  4. UOM

And in the _execute function, we grouped it by:

  1. Parent
  2. Item Code

And then added only 1 matching data to the report.

This caused issue as only 1 entry from the 1st group was considered by the report.

Solution:
This PR changed the grouping to:
SQL:

  1. Parent
  2. HSN Code
  3. Item Code

_execute function:

  1. Parent
  2. HSN Code
  3. Item Code

Also re-wrote the test case to accommodate this scenario.

@rtdany10
Copy link
Contributor Author

@sagarvora @vorasmit please review :)

@rtdany10
Copy link
Contributor Author

@vorasmit 😬

Copy link
Member

@vorasmit vorasmit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Developer Note:

UOM grouping is irrelevant as the report is based on Stock UOM.
One item can only have one stock UOM.

@vorasmit vorasmit merged commit d51c329 into resilient-tech:next Nov 14, 2022
vorasmit added a commit that referenced this pull request Nov 14, 2022
…fix/pr-333

fix: hsn summary calculation (backport #333)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants