Coder Social home page Coder Social logo

Comments (5)

waynerobinson avatar waynerobinson commented on July 18, 2024

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.

corroded avatar corroded commented on July 18, 2024

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.

brancusi avatar brancusi commented on July 18, 2024

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.

SylarRuby avatar SylarRuby commented on July 18, 2024

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.

rjaus avatar rjaus commented on July 18, 2024

Tested this today, issue no longer present. It was likely fixed a while back.

#416

from xeroizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.