Avoid comparison between tuple and int in one2many position
Such comparison is no more supported on Python 3. issue7998 review46801002
This commit is contained in:
1 parent
0fb0609697
commit
b1dd1e7331
2 files changed
+10
-5
No files matched your search
@@ -433,8 +433,8 @@ class Screen(SignalEvent):
|
||||
# XXX offset?
|
||||
pos = record.get_index_path()
|
||||
else:
|
||||
pos = None
|
||||
self.signal('record-message', (pos or 0, len(self.group) + self.offset,
|
||||
pos = 0
|
||||
self.signal('record-message', (pos, len(self.group) + self.offset,
|
||||
self.search_count, record and record.id))
|
||||
attachment_count = 0
|
||||
if record and record.attachment_count > 0:
|
||||
|
||||
@@ -257,6 +257,11 @@ class One2Many(Widget):
|
||||
o2m_size = None
|
||||
size_limit = False
|
||||
|
||||
first = last = False
|
||||
if isinstance(self._position, int):
|
||||
first = self._position <= 1
|
||||
last = self._position >= self._length
|
||||
|
||||
self.but_new.set_sensitive(bool(
|
||||
not self._readonly
|
||||
and self.attrs.get('create', True)
|
||||
@@ -276,10 +281,10 @@ class One2Many(Widget):
|
||||
and access['read']))
|
||||
self.but_next.set_sensitive(bool(
|
||||
self._position
|
||||
and self._position < self._length))
|
||||
and not last))
|
||||
self.but_pre.set_sensitive(bool(
|
||||
self._position
|
||||
and self._position > 1))
|
||||
and not first))
|
||||
if self.attrs.get('add_remove'):
|
||||
self.but_add.set_sensitive(bool(
|
||||
not self._readonly
|
||||
@@ -481,7 +486,7 @@ class One2Many(Widget):
|
||||
def _sig_label(self, screen, signal_data):
|
||||
self._position = signal_data[0]
|
||||
self._length = signal_data[1]
|
||||
if self._position >= 1:
|
||||
if self._position:
|
||||
name = str(self._position)
|
||||
else:
|
||||
name = '_'
|
||||
|
||||
Reference in new issue
Block a user