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: Invoice identifier and generation behaviour change #7314

Merged
merged 2 commits into from
Oct 2, 2020

Conversation

iamareebjamal
Copy link
Member

@iamareebjamal iamareebjamal commented Oct 2, 2020

Fixes fossasia/open-event-frontend#5211

  • Left pad event invoice number with leading zeroes
  • Do not generate invoice if amount is 0
  • Add due_at in event invoice schema

@@ -119,6 +117,9 @@ def generate_pdf(self):
if invoice_amount > ticket_fee_maximum:
invoice_amount = ticket_fee_maximum
self.amount = round_money(invoice_amount)
if self.amount == 0:
logger.warning('Invoice amount of Event %s is 0, hence skipping generation', self.event)

Choose a reason for hiding this comment

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

line too long (104 > 90 characters)

identifier = self.issued_at.strftime('%Y%mU-') + str(
EventInvoice.query.count() + 1
)
identifier = self.issued_at.strftime('%Y%mU-') + '%06d' % (EventInvoice.query.count() + 1)

Choose a reason for hiding this comment

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

line too long (102 > 90 characters)

@@ -62,13 +62,11 @@ def __init__(self, **kwargs):
self.identifier = self.get_new_id()

def __repr__(self):
return '<EventInvoice %r>' % self.invoice_pdf_url
return '<EventInvoice %r %r %r>' % (self.id, self.identifier, self.invoice_pdf_url)

Choose a reason for hiding this comment

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

line too long (91 > 90 characters)

@@ -200,14 +200,16 @@ def send_event_invoice(
try:
save_to_db(event_invoice)
saved = True
logger.info('Generated Event invoice %s for %s. Amount: %f', event_invoice, event, event_invoice.amount)

Choose a reason for hiding this comment

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

line too long (124 > 90 characters)

@auto-label auto-label bot added the fix label Oct 2, 2020
@codecov
Copy link

codecov bot commented Oct 2, 2020

Codecov Report

Merging #7314 into development will increase coverage by 0.00%.
The diff coverage is 54.54%.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #7314   +/-   ##
============================================
  Coverage        64.12%   64.12%           
============================================
  Files              259      259           
  Lines            13078    13084    +6     
============================================
+ Hits              8386     8390    +4     
- Misses            4692     4694    +2     
Impacted Files Coverage Δ
app/models/event_invoice.py 93.00% <33.33%> (-1.85%) ⬇️
app/api/helpers/scheduled_jobs.py 60.00% <66.66%> (+0.62%) ⬆️
app/api/schema/event_invoices.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d052613...ef413a2. Read the comment docs.

@iamareebjamal iamareebjamal merged commit ca2243e into development Oct 2, 2020
@iamareebjamal iamareebjamal deleted the invoice-id-pad branch October 2, 2020 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invoice: Adjust invoice handling UI and Invoice Numbering
2 participants