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: subscription refactor #30963

Merged
merged 11 commits into from
Aug 7, 2023
Merged

Conversation

hrwX
Copy link
Contributor

@hrwX hrwX commented May 10, 2022

  • Reopened the PR refactor: subscriptions #29870 here as the branch was messed up.
  • Reduced complexity associated with invoice generation function, got rid of is_postpaid_to_invoice and is_prepaid_to_invoice.
def can_generate_new_invoice(self) -> bool:
    if self.cancelation_date:
	    return False
    elif self.generate_invoice_at_period_start and (
	    getdate(frappe.flags.current_date) == getdate(self.current_invoice_start)
	    or self.is_new_subscription()
    ):
	    return True
    elif getdate(frappe.flags.current_date) == getdate(self.current_invoice_end):
	    if self.has_outstanding_invoice() and not self.generate_new_invoices_past_due_date:
		    return False
    
	    return True
    else:
	    return False
  • The invoices won't be generated randomly, they will only be generated either at the beginning of the period or the end of the period depending on the configuration, eliminating the randomness of earlier implementation.
  • Removed redundant child table for saving invoices. Added a link field in Sales and Purchase Invoice
  • New Subscription Layout
    image

no-docs

@hrwX hrwX mentioned this pull request May 10, 2022
@hrwX hrwX force-pushed the subscription_ref branch from a52b883 to 40c5f6f Compare May 20, 2022 22:25
@hrwX hrwX marked this pull request as ready for review May 21, 2022 10:38
@stale
Copy link

stale bot commented Jun 25, 2022

This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@stale stale bot added the inactive label Jun 25, 2022
@stale stale bot closed this Jun 29, 2022
@federicocalvo
Copy link

Hi, this is the most important doctype/function for any service company. And it is becoming more and more common, so not only does a refactor make sense, but it already marks a horizon with improvements.

@stale
Copy link

stale bot commented Apr 29, 2023

This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@stale stale bot removed the inactive label Jul 25, 2023
@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Merging #30963 (fbbf6e2) into develop (8c410c6) will increase coverage by 0.48%.
Report is 192 commits behind head on develop.
The diff coverage is 84.27%.

❗ Current head fbbf6e2 differs from pull request most recent head 380aede. Consider uploading reports for the commit 380aede to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #30963      +/-   ##
===========================================
+ Coverage    64.11%   64.59%   +0.48%     
===========================================
  Files          785      788       +3     
  Lines        60780    61371     +591     
===========================================
+ Hits         38970    39645     +675     
+ Misses       21810    21726      -84     
Files Changed Coverage Δ
...t/crm/doctype/twitter_settings/twitter_settings.py 0.00% <0.00%> (ø)
...next/accounts/doctype/subscription/subscription.py 84.69% <88.74%> (+1.99%) ⬆️

... and 50 files with indirect coverage changes

@deepeshgarg007 deepeshgarg007 merged commit 3880560 into frappe:develop Aug 7, 2023
@deepeshgarg007 deepeshgarg007 added the backport version-14-hotfix backport to version 14 label Oct 31, 2023
mergify bot pushed a commit that referenced this pull request Oct 31, 2023
* feat: subscription refactor

* fix: linter changes

* chore: linter changes

* chore: linter changes

* chore: Update tests

* chore: Remove commits

---------

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
(cherry picked from commit 3880560)

# Conflicts:
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
#	erpnext/accounts/doctype/sales_invoice/sales_invoice.json
#	erpnext/accounts/doctype/subscription/subscription.py
#	erpnext/accounts/doctype/subscription/test_subscription.py
#	erpnext/patches.txt
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants