I have a model with two attribute of Many2one stock.location.
First is parent, second is child. I was trying to set second location based on first. It always return
class store_location(models.Model):It result error
_name = 'store'
national_store = fields.Many2one('stock.location', "National", domain=[('type', '=', 'national')])
regional_store = fields.Many2one('stock.location', "Regional", domain=[('location_id', '=', national_store)]
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 530, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 581, in dispatch return self._json_response(result) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 519, in _json_response body = simplejson.dumps(response) File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 366, in dumps return _default_encoder.encode(obj) File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 269, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 348, in iterencode return _iterencode(o, 0) File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 246, in default raise TypeError(repr(o) + " is not JSON serializable") File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 442, in __repr__ return "%s.%s" % (self.model_name, self.name) File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 329, in __getattr__ raise AttributeError(name) AttributeError: model_name
I'm not sure but I use 'domain' without s
My mistake, attribute is domain (corrected)