Comments (5)
Have you tried:
part.purchase_details.unit_amount = 20.0
part.save
On 25/02/2013, at 7:15 PM, Eumir Gaspar [email protected] wrote:
We've been trying to update a Xero Item's unit and cost prices by doing:
parts = @xero.Item.all
part = parts.first
part.attributes
=> {:item_id=>"75189459-e8ad-4007-bec3-10044e673996",
:code=>"BOOK",
:description=>"'Fish out of Water: Finding Your Brand'",
:purchase_details=>
#<Xeroizer::Record::ItemPurchaseDetails :unit_price:
#BigDecimal:7fa8ced86e80,'0.1595E2',18(18), :account_code: "300",
:tax_type: "INPUT2">,
:sales_details=>
#<Xeroizer::Record::ItemSalesDetails :unit_price:
#BigDecimal:7fa8ced8d528,'0.1995E2',18(18), :account_code: "200",
:tax_type: "OUTPUT2">}
part.purchase_details
=> #<Xeroizer::Record::ItemPurchaseDetails :unit_price:
#BigDecimal:7fa8ced86e80,'0.1595E2',18(18), :account_code: "300",
:tax_type: "INPUT2">
part.purchase_details.update_attributes unit_price: 20.0
TypeError: nil is not a symbol
from /Users/dev/.rvm/gems/ruby-1.9.3-p194@spanner/gems/xeroizer-2.15.3/lib/xeroizer/record/base.rb:50:in
`[]'
It looks like this is possible in the API, but not in xeroizer? Is there a
way to update the unit price of an Item?
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/69.
from xeroizer.
Yup, actually that's the first thing we tried because we did it successfully by using
part.description = "new desc"
part.save
but when we did it for purchase details, we got that error. Upon our initial investigation, it seems like it is throwing that error when it tries to check if part is a new record or not. (it fails in id.nil?
). Checking part.purchase_details.id
will produce that same error as well.
from xeroizer.
Any fix on this? I have also been trying and have had no luck.
I have tried both setting my_item.unit_price
and my_item.purchase_details.unit_price
The second one fails.
I have also tried creating the purchase details record directly:
record.purchase_details = Xeroizer::Record::ItemPurchaseDetails.new(record) if record.purchase_details.nil?
With the last attempt I get an error:
undefined method `mark_dirty' for #<Xeroizer::Record::Item:0x007f7f6c6f49b8>
Thanks
from xeroizer.
I got stacklevel too deep
item = xero.Item.find(<id>)
item.purchase_details.unit_price # stack too deep
A 2013 post, any fix?
from xeroizer.
Tested this today, issue no longer present. It was likely fixed a while back.
from xeroizer.
Related Issues (20)
- Question: Does Xeroizer support OAuth 2? HOT 2
- `.sent_to_contact` on Invoices is undefined HOT 3
- Update the readme/documentation to include Oauth2Application HOT 2
- Xero Deprecation Notice - OAuth 1.0a HOT 1
- Timeout option not set correctly on OAuth 2 client HOT 3
- invoice.save returns false but invoice.errors is empty HOT 15
- New gem release? HOT 6
- How to get all the Items from Xero account HOT 1
- NameError: uninitialized constant Xeroizer::OAuth2Application HOT 4
- Double raise for expired tokens? HOT 2
- GET ERROR WHE do any object.save HOT 2
- trying to run tests as a developer... HOT 5
- syntax error, unexpected ',' in branding_theme.rb HOT 1
- Line Amount can not explicity be set to 0.00 if there is a discount
- Missing require somewhere: "uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState" when used outside of Rails HOT 3
- AuthorizationUnsuccessful error HOT 2
- ApiExceptions result in parse error
- Saving Quotes
- BankAccount Model Not Available?
- How to revoke token / delete current_connection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xeroizer.