← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 625889] Re: exception thrown with missing property- trunk

 

Hello Jim,

     I have checked the scenario.But the problem does not appear at my
end. Would you please update the code and recheck.

Thanks.

** Changed in: openobject-client
       Status: New => Invalid

** Changed in: openobject-client
    Milestone: None => 6.0

-- 
exception thrown with missing property- trunk
https://bugs.launchpad.net/bugs/625889
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP OpenObject.

Status in OpenObject GTK Client: Invalid

Bug description:
The following exception is thrown if a field with definition fields.property is missing:

  File "/opt/openerp/trunk/client/bin/widget/view/list.py", line 627, in __sig_switch
    self.screen.row_activate(self.screen)
  File "/opt/openerp/trunk/client/bin/widget/screen/screen.py", line 76, in <lambda>
    self.row_activate = lambda self,screen=None: self.switch_view(screen, 'form')
  File "/opt/openerp/trunk/client/bin/widget/screen/screen.py", line 470, in switch_view
    self.current_model.validate_set()
  File "/opt/openerp/trunk/client/bin/widget/model/record.py", line 181, in validate_set
    self.reload()
  File "/opt/openerp/trunk/client/bin/widget/model/record.py", line 256, in reload
    return self._reload(self.mgroup.mfields.keys() + [CONCURRENCY_CHECK_FIELD])
  File "/opt/openerp/trunk/client/bin/widget/model/record.py", line 270, in _reload
    self.set(value)
  File "/opt/openerp/trunk/client/bin/widget/model/record.py", line 253, in set
    self.signal('record-changed')
  File "/opt/openerp/trunk/client/bin/signal_event.py", line 28, in signal
    fnct(self, signal_data, *data)
  File "/opt/openerp/trunk/client/bin/widget/model/group.py", line 295, in _record_changed
    self.signal('model-changed', model)
  File "/opt/openerp/trunk/client/bin/signal_event.py", line 28, in signal
    fnct(self, signal_data, *data)
  File "/opt/openerp/trunk/client/bin/widget/screen/screen.py", line 396, in _model_changed
    self.display()
  File "/opt/openerp/trunk/client/bin/widget/screen/screen.py", line 728, in display
    self.current_view.display()
  File "/opt/openerp/trunk/client/bin/widget/view/form.py", line 480, in display
    widget.display(model, state)
  File "/opt/openerp/trunk/client/bin/widget/view/form.py", line 52, in display
    self.widget.display(model, modelfield)
  File "/opt/openerp/trunk/client/bin/widget/view/form_gtk/one2many_list.py", line 383, in display
    self.pager.search_count()
  File "/opt/openerp/trunk/client/bin/widget/view/form_gtk/pager.py", line 57, in search_count
    self.screen.search_count = len(self.object.model.pager_cache.get(self.object.name,[]))
TypeError: object of type 'bool' has no len()

The following code change to pager.py fixes the problem:


=== modified file 'bin/widget/view/form_gtk/pager.py'
--- bin/widget/view/form_gtk/pager.py	2010-04-21 11:24:05 +0000
+++ bin/widget/view/form_gtk/pager.py	2010-08-28 15:48:13 +0000
@@ -53,15 +53,19 @@
         return event_box
 
     def search_count(self):
-        self.screen.search_count = len(self.object.model.pager_cache.get(self.object.name,[]))
-        try:
-            pos = self.screen.models.models.index(self.screen.current_model)
-        except:
+        # if property not present, will return False
+        if self.object.model.pager_cache.get(self.object.name,[]):
+            self.screen.search_count = len(self.object.model.pager_cache.get(self.object.name,[]))
+            try:
+                pos = self.screen.models.models.index(self.screen.current_model)
+            except:
+                pos = -1
+            curr_id =  self.screen.current_model and self.screen.current_model.id or None
+            self.screen.signal('record-message', (pos + self.screen.offset,
+                len(self.screen.models.models or []) + self.screen.offset,
+                self.screen.search_count, curr_id))
+        else:
             pos = -1
-        curr_id =  self.screen.current_model and self.screen.current_model.id or None
-        self.screen.signal('record-message', (pos + self.screen.offset,
-            len(self.screen.models.models or []) + self.screen.offset,
-            self.screen.search_count, curr_id))
 
     def get_active_text(self):
         model = self.object.cb.get_model()