Support Attaching Files#245
Support Attaching Files#245jordan-allan wants to merge 2 commits intoNetSweet:masterfrom jordan-allan:attach-reference
Conversation
jordan-allan
commented
Feb 25, 2016
- Adds support for attaching files
- Action added to Invoice
| end | ||
|
|
||
| def record_type_without_namespace | ||
| "#{self.class.to_s.split('::').last}" |
There was a problem hiding this comment.
👍 Yes!! I've been wanting to add this for a while. Thanks!
|
@jdedels Thanks for this! Great PR. There are some great changes in here, and I'd like to take a closer look before I merge it in. |
|
|
||
| def type | ||
| record_type_without_namespace.downcase | ||
| end |
There was a problem hiding this comment.
@jdedels I'm not too familiar with the attach_file call, but I believe types should be lower camel case, i.e. customer, salesOrder, transferOrder, etc. Do you know if attach_file uses a different type case or did you just test this with single-word objects?
Thanks again for your help here! Sorry about the delay in taking a look at this
There was a problem hiding this comment.
You're right, it should be lower camel case. I just tested with a sales order and got the following error:
Savon::SOAPFault ((soapenv:Server.userException) org.xml.sax.SAXException: salesorder is not a legal value for {urn:types.core_2020_2.platform.webservices.netsuite.com}RecordType)
Changing the downcase call to lower_camelcase fixed the issue.
Separately, #483 broke this because it introduces a type search-only field on invoices, so when the action calls type to fill out the XML request body, it calls the search-only field, returning nil (unless your record instance happens to be the result of a search), rather than calling this helper.
Broadly I'd guess this is a problem with any instance methods defined on a record colliding with fields on that record. Maybe netsuite_type is better and less chance for collision? Then maybe record_type should be renamed to netsuite_namespaced_type for consistency and clarity?
|
Closing this out in favor of #509 |