GithubHelp home page GithubHelp logo

Comments (2)

guewen avatar guewen commented on July 29, 2024

I expect that the cause of the problem is the name of the Magento ERP Connector's column "attributes".

My attribute set object is :
(Retrieved with :
MagerpProduct_attribute_set.find(:first, :domain=>[['id','=',75]], :fields=>['attributes']))
)

#<MagerpProduct_attribute_set:0xb6989a84
 @attributes={"id"=>75},
 @ir_model_data_id=nil,
 @loaded_relations={},
 @object_session={:context=>{}, :user_id=>nil, :password=>nil, :database=>nil},
 @prefix_options={},
 @relations=
  {"attributes"=>
    [24,
     25,
     26,
     27]}>

The returned object contains an "@attributes" instance variable which is the list of the table's columns. OOOR creates a method for each item in "@relations", but one of them is named "attributes" which already exists.

This is my suggestion on the cause of the trouble.

I don't know if this is more an OOOR or Magento ERP Connector bug, but it's sure this is a big issue because when using Magento ERP Connector, it is impossible to retrieve the attributes from an attribute set and furthermore to use an attribute set object.

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'ooor'
=> true
irb(main):003:0> require 'pp'
=> ["PP"]
irb(main):004:0> ooor = Ooor.new({:url => "http://localhost:8045/xmlrpc", :database => "openerp_debonix", :username => "admin", :password => "admin"})
(...)
irb(main):005:0> attribute_sets = MagerpProduct_attribute_set.find(:first, :domain=>[['id','=',75]], :fields=>['id'])
D, [2010-09-29T10:59:06.723879 #32636] DEBUG -- : rpc_execute_with_all: rpc_method: 'execute', db: "openerp_debonix", uid: 1, pass: "admin", obj: "magerp.product_attribute_set", method: search, *args: [[["id", "=", 75]], 0, false, false, {}]
D, [2010-09-29T10:59:06.747557 #32636] DEBUG -- : rpc_execute_with_all: rpc_method: 'execute', db: "openerp_debonix", uid: 1, pass: "admin", obj: "magerp.product_attribute_set", method: fields_get, *args: []
I, [2010-09-29T10:59:06.761196 #32636]  INFO -- : 3 fields loaded in model Class
D, [2010-09-29T10:59:06.761353 #32636] DEBUG -- : rpc_execute_with_all: rpc_method: 'execute', db: "openerp_debonix", uid: 1, pass: "admin", obj: "magerp.product_attribute_set", method: read, *args: [[75], ["id"], {}]
=> #<MagerpProduct_attribute_set:0xb6a167b8 @relations={}, @prefix_options={}, @object_session={:context=>{}, :user_id=>nil, :password=>nil, :database=>nil}, @loaded_relations={}, @ir_model_data_id=nil, @attributes={"id"=>75}>
irb(main):006:0> pp attribute_sets
#<MagerpProduct_attribute_set:0xb6a167b8
 @attributes={"id"=>75},
 @ir_model_data_id=nil,
 @loaded_relations={},
 @object_session={:context=>{}, :user_id=>nil, :password=>nil, :database=>nil},
 @prefix_options={},
 @relations={}>
=> nil
irb(main):007:0> print attribute_sets.id
SystemStackError: stack level too deep
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
... 2447 levels...
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:465:in `method_missing'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `send'
    from /var/lib/gems/1.8/gems/ooor-1.4.2/lib/app/models/open_object_resource.rb:74:in `attributes'
    from /var/lib/gems/1.8/gems/activeresource-3.0.0/lib/active_resource/base.rb:1039:in `id'
    from (irb):7
    from �:0i

from ooor.

rvalyi avatar rvalyi commented on July 29, 2024

Hum, indeed it sucks. I guess you could work around in this case using meta-programming (like switch methods, temporarily eventually, see method alias here http://whynotwiki.com/Ruby_/_Method_aliasing_and_chaining ). Of course anytime you have a column named like a "reserved" ActiveResource word, you can run into such issue. Thank you for the detailed report, if you find some work-around, please let us know.

from ooor.

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.