Closed ghost closed 9 years ago
@bwrsandman you can make the test 1 - go to the list of travel.travel 2 - export the data including the field travel_state of the related traveller you will get an error saying the field has no attribute selection
@bwrsandman in openerp/osv/orm.py ? in __export_row row 1173 I know this does not seem much logic, and this could be fixed in the orm. I guess this problem is fixed in v8.
Ok, I see the error. That's an odoo bug.
One thing to fix, though. Don't duplicate the states, just factor them into a class-less function in travel.py
def _get_states(self, cr, uid, ids=None, context=None):
return [
('draft', _('Draft')),
('open', _('Saved')),
('booking', _('In Reservation')),
('reserved', _('Reserved')),
('confirmed', _('Confirmed')),
('done', _('Closed')),
]
Then use it like this:
from openerp.addons.travel.travel import _get_states
# ...
_columns = {
# ...
'state': fields.related(
selection=lambda *a, **kw: _get_states(*a, **kw),
),
# ...
}
Also factor the original so the states are only defined once.
@bwrsandman can you add wip label ?
@bwrsandman I fixed the issue. You may remove the wip label. Thanks
:+1:
:+1: review no test
@max3903 Can you merge this PR please ?
@max3903 @dufresnedavid This repo has been failing since this was merged, please fix before merging anythin else.
@bwrsandman the travis build was ok in this PR. Why do you think it is related to the current problem ? I would say https://github.com/OCA/vertical-travel/pull/38 is the cause of the problem.
This was merged before #38 and you can see the build starts failing at this merge:
Why are these missing? The field is related. Please explain the change.