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

feat: Enable discount accounting #26359

Merged
merged 54 commits into from
Aug 14, 2021

Conversation

GangaManoj
Copy link
Contributor

@GangaManoj GangaManoj commented Jul 6, 2021

Problem:

Currently any item or addition discount applied is accounted in the Income account itself and there is no way to account for discounts in a separate account head. The only workaround possible for now is to use Item Tax templates with negative rate but there is no way to apply fixed amount discount (has to be done manually by back calculating rate) and add that rate in Item Tax Template

Fix:

  • Add a checkbox to Enable Discount Accounting in Accounts Settings.

Screenshot 2021-07-06 at 8 27 23 PM

  • If the aforementioned box is checked, the Discount Account field in the Items table for Sales and Purchase Invoices will be made visible using a Property Setter.

Screenshot 2021-07-06 at 8 31 28 PM

  • This will be allow you to create GL Entries in the following manner:
For Sales Invoice

Screenshot 2021-07-06 at 8 42 58 PM

For Purchase Invoice

Screenshot 2021-07-13 at 3 04 48 AM

  • Additionally, you could enter a Default Discount Account for an Item, which will be fetched automatically while creating the Invoice. The visibility for this field is also dependant on the Enable Discount Accounting checkbox in Accounts Settings.

Screenshot 2021-07-06 at 8 46 32 PM

  • If Enable Discount Account is checked, the Additional Discount Account field will also be made visible. On submitting the invoice, GL Entries will be made against the Additional Discount Account for the Additional Discount Amount, as show in the given example.

Screenshot 2021-07-15 at 9 59 01 PM

Example

Item cost = Rs 100
Tax Amount = Rs 20
Discount Percentage = 20%
Therefore, Discount Amount = Rs 24

For Sales Invoice

Before:

Screenshot 2021-07-20 at 2 20 26 AM

After:

Screenshot 2021-07-20 at 2 20 04 AM

For Purchase Invoice

Before:

Screenshot 2021-07-20 at 3 31 28 AM

After:

Screenshot 2021-07-20 at 3 30 25 AM

Docs
Testing Info
  1. Open Accounts Settings.
  2. Check the Enable Discount Accounting box.
  3. Create a new Item/open an existing Item and go to the Sales Defaults section.
  4. Enter a Default Discount Account.
  5. Create a Sales Invoice for that Item.
  6. Enter Discount Amount in the Items table.
  7. The Discount Account will be the Item's Default Discount Account, but this can be changed.
  8. Save and Submit.
  9. Check the GL Entries created and see if they're similar to ones in the image provided above.

Copy link
Member

@deepeshgarg007 deepeshgarg007 left a comment

Choose a reason for hiding this comment

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

  • One more discount account field at parent level needs to be added if additional discounts are applied. If additional discount is applied on Grand Total then tax GL Entries should be made for full amount instead of post discount amount

  • Add test cases

@coveralls
Copy link

Coverage Status

Coverage remained the same at 42.826% when pulling b85d301 on GangaManoj:enable-discount-accounting into 0b320b5 on frappe:develop.

GangaManoj and others added 7 commits July 19, 2021 23:44
Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
@nabinhait
Copy link
Member

Great description for PR 👍

@GangaManoj
Copy link
Contributor Author

@nabinhait Thanks!

@deepeshgarg007 deepeshgarg007 merged commit 7145e9d into frappe:develop Aug 14, 2021
@@ -286,6 +286,7 @@ def get_basic_details(args, item, overwrite_warehouse=True):
"warehouse": warehouse,
"income_account": get_default_income_account(args, item_defaults, item_group_defaults, brand_defaults),
"expense_account": expense_account or get_default_expense_account(args, item_defaults, item_group_defaults, brand_defaults) ,
"discount_account": None or get_default_discount_account(args, item_defaults),
Copy link
Contributor

@pruthvi145 pruthvi145 Sep 17, 2021

Choose a reason for hiding this comment

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

Why you did None or? Isn't it always run the second part?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants