OCA / vertical-travel

GNU Affero General Public License v3.0
33 stars 75 forks source link

AttributeError: 'related' object has no attribute 'selection' #13

Closed hengkysipocs closed 9 years ago

hengkysipocs commented 9 years ago
File "/opt/odoo/v8/openerp/models.py", line 243, in __init__
    setattr(self, name, column.to_field())
  File "/opt/odoo/v8/openerp/osv/fields.py", line 129, in to_field
    return Field.by_type[self._type](**self.to_field_args())
  File "/opt/odoo/v8/openerp/osv/fields.py", line 1252, in to_field_args
    args['selection'] = self.selection
pedrobaeza commented 9 years ago

This is because the related selection field has store=True. In that case, you need to indicate the full list of selection options in the field.

liebendkl commented 9 years ago
_columns = {
    'travel_state': fields.related(
    'travel_id', 'state', type='selection', string='State'),
}

how to do that for example in that case?

liebendkl commented 9 years ago

Hello, we need a help with these issue , because we cant install module to see is that what we are looking for. as i think problem is in travel_passenger.py???

pedrobaeza commented 9 years ago

I have indicated the proper solution. Can you do it and make the corresponding PR?

mjb2000 commented 9 years ago

Hi @pedrobaeza - I am also having this problem. Could you talk me through the solution you have indicated. I am new to this, so your references to store=True don't mean anything to me at the moment.

Many thanks

pedrobaeza commented 9 years ago

You have to add selection argument with the list of tuples (db_value, label). For example, ...selection=[('1', 'One'), ('2', 'Two')]...

mjb2000 commented 9 years ago

Thanks for your quick reply. Where do I add this and to what file?

pedrobaeza commented 9 years ago

To the field where there are the problems.

mjb2000 commented 9 years ago

Sorry - I should explain that I litterally installed Odoo for the first time around 60 minutes ago, so I have no idea what 'field' is causing the problem.

I have installed on Debian and within the web interface gone to Settings > Apps and searched through the entire list to find 'Travel' - When I install it, this is the error I get.

Should I be installing the Travel add-on differently?

At this stage I am just doing an early evaluation of Odoo to see if it might work with what I've got planned.

mjb2000 commented 9 years ago

I have just tried a second installation, this time on Windows, but I got the same error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\http.py", line 530, in _handle_exception
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\http.py", line 567, in dispatch
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\http.py", line 303, in _call_function
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\service\model.py", line 113, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\http.py", line 300, in checked_call
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\http.py", line 796, in __call__
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\http.py", line 396, in response_wrap
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\openerp\addons\web\controllers\main.py", line 953, in call_button
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\openerp\addons\web\controllers\main.py", line 941, in _call_kw
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\api.py", line 241, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\openerp\addons\base\module\module.py", line 729, in install_from_urls
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\api.py", line 241, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\openerp\addons\base\module\module.py", line 450, in button_immediate_install
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\api.py", line 241, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\openerp\addons\base\module\module.py", line 498, in _button_immediate_function
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\modules\registry.py", line 366, in new
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\modules\loading.py", line 355, in load_modules
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\modules\loading.py", line 255, in load_marked_modules
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\modules\loading.py", line 143, in load_module_graph
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\modules\module.py", line 315, in load_openerp_module
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\modules\module.py", line 80, in load_module
  File "C:\Users\MattBunce\AppData\Local\OpenERP S.A.\Odoo\addons\8.0\travel\__init__.py", line 23, in <module>
  File "C:\Users\MattBunce\AppData\Local\OpenERP S.A.\Odoo\addons\8.0\travel\travel_passenger.py", line 27, in <module>
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\models.py", line 254, in __init__
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\osv\fields.py", line 159, in to_field
  File "C:\Program Files (x86)\Odoo 8.0-20150303\server\.\openerp\osv\fields.py", line 1308, in to_field_args
AttributeError: 'related' object has no attribute 'selection'
metamoof commented 9 years ago

I'm also having this issue, attempting to evaluate odoo 8 apps

mjb2000 commented 9 years ago

It's a shame. The descriptions of the functionality I have read elsewhere sound perfect, but unfortunately it seems that the support for newcomers to implement anything is extremely limited.

If anyone is able to explain how to install this module I would really appreciate it :)

yvaucher commented 9 years ago

@bwrsandman @ehdem Did you see this issue?

yvaucher commented 9 years ago

Error seems to come from there:

https://github.com/OCA/vertical-travel/blob/8.0/travel/travel_passenger.py#L42-43

And it needs same list as in

https://github.com/OCA/vertical-travel/blob/8.0/travel/travel.py#L54-59

bwrsandman commented 9 years ago

This issue is due to the fact that the travel modules have not been ported to 8.0 from 7.0.

This has not yet been planned. The porting, though should not be difficult as these modules don't really touch that many other modules.

bwrsandman commented 9 years ago

Initial port to 8.0 is available in #28 Feel free to test that version

mjb2000 commented 9 years ago

Hi @bwrsandman, thanks for taking a look at this. Should I be able to install this via the UI, or do I need to download a zip from GitHub and add it to my Odoo install somewhere?

How do I download a zip of your #28 version?

Thanks

yvaucher commented 9 years ago

@mjb2000 You can get the change of the pull request #28 by doing

git clone git@github.com:oca/vertical-travel
git pull origin pull/28/head

Otherwise you can see the branch name on top of the Pull request: savoirfairelinux:8.0-travel-port Thus go on https://github.com/savoirfairelinux/vertical-travel/tree/8.0-travel-port and download it from there

bwrsandman commented 9 years ago

@mjb2000 You can also download it via https://github.com/savoirfairelinux/vertical-travel/archive/8.0-travel-port.zip

Let us know if you have any issues with that module in #28

Note that it's only the base module that was ported. A dev will need to put time to port the rest.

mjb2000 commented 9 years ago

Thank you. I unziped the travel folder to the 'addons' folder and then went ahead with the install. I am still getting the same error, but I am not sure if this is because of one of the other module dependencies failing, or if the install process is downloading the content from GitHub rather than using the update I had extracted to the addons folder?

bwrsandman commented 9 years ago

@mjb2000 is this on a new database or the same as where the error occured before?

More to the point, do you have any other travel* modules installed. They might be the cause of the issue due to them being unported.

bwrsandman commented 9 years ago

This issue should be fixed with the travel module being ported to 8.0