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

Due date shouldn't be a required field when updating an invoice #395

Open
ryanwilliams opened this issue Oct 25, 2017 · 4 comments
Open
Labels

Comments

@ryanwilliams
Copy link

At the moment if you create an invoice you don't need to specify a due date. But if you wish to update an invoice you must specify a due date.

This doesn't seem right as Xero doesn't care if the due date is blank.

@rjaus
Copy link
Collaborator

rjaus commented Jan 24, 2018

Correct, DueDate is only required for creation. Update don't require the field to specified (although it should already exist).

Can you explain the use case in which this is a problem in practice? I would expect the object to already have a DueDate in any case where you're updating the invoice.

@ryanwilliams
Copy link
Author

This is an issue because DueDate is optional on create. Xero doesn't require it. So you can create an invoice without one just fine, but then if you attempt to update it you can't unless you add a DueDate.

@CloCkWeRX CloCkWeRX added the bug label Jan 24, 2018
@rjaus
Copy link
Collaborator

rjaus commented Feb 20, 2018

Hey @ryanwilliams. The issue is actually dependant on the of the invoice. If invoice.status == DRAFT, no DueDate is required (on PUT or POST). But if invoice.status == AUTHORISED DueDate is a required field (for PUT & POST).

If you want to enforce this behaviour in the wrapper, I'd change this line:

https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/models/invoice.rb#L93

From:

validates_presence_of :date, :due_date, :unless => :new_record?

To:

validates_presence_of :date, :due_date, :if => :approved?

Just trying to think of the flow on effects before making this change in master.

@Samsinite
Copy link

Getting the same error over here, after a batch save all of the invoices report an error because due_date is blank even though it was saved on the xero side just fine.

rjaus added a commit that referenced this issue Sep 22, 2021
rjaus added a commit that referenced this issue Sep 27, 2021
* tests are running successfully now

* removed deprecated private, public, partner apps and removed/upgrade oauth1 related tests

* version bump 3.0.0

* invoice change to fix issue #395

* resolves issue #442

* added gdpr request status for contacts to resolve #441

* fixed issue #448

* invoice requires date, added to test

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

No branches or pull requests

4 participants