-
Notifications
You must be signed in to change notification settings - Fork 311
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
Comments
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. |
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. |
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. |
Getting the same error over here, after a batch save all of the invoices report an error because |
* 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
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.
The text was updated successfully, but these errors were encountered: