Comments (2)
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.
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)
- cannot find custom fields in object HOT 2
- split integration tests by Odoo series
- AttributeError: 'NoneType' object has no attribute 'fields_get'
- odoo v10 compatibilty HOT 6
- probable thread safety issue with Rack middleware HOT 1
- Rails 5 error HOT 3
- Rails 5 compatibility? HOT 7
- NameError: uninitialized constant ActiveSupport::Notifications HOT 5
- Scope prefix and undefined model HOT 1
- remove the scope prefix feature?
- generate ooor.yml file on installation along with Rails
- doc: list Rails/web gems ooor plays well with
- NameError: uninitialized constant ActiveModel::Serializers::Xml HOT 1
- session#public_controller_method: do not require the addressable/uri gem
- find :first, :all, :last is deprecated/removed in ActiveRecord
- optional new transport layer: pycall
- Calling workflow method has no effect HOT 3
- Error when calling on_change method HOT 1
- Error when trying to get data HOT 5
- new version + rubygems release
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 ooor.