Editable list views don't enforce requiered fields when used in a popup

Bug #479302 reported by Numérigraphe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
Fix Released
Undecided
Anup(SerpentCS)
Nominated for 5.0 by Numérigraphe

Bug Description

In the GTK client, when you create an object composed of another object ( object -> one2many -> details), the "component" object will usually be entered in a form open as a popup window.

If this form contains an editable list (component -> one2many -> sub-component), this list does not enforce required fields, resulting in invalid forms.
As a consequence the object can not be saved, though the user is not warned of the failure.
On windows, crashes of the GTK client have been observed too.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Please find attached an example module showing the bug.
- install the module
- go to the menu "MyObject > MyObject"
- enter a name
- click the button to create a new entry for my.object.details => it should open a popup window
- enter a name for the details
- click several times the button to create a new entry for "Elements" - don't enter anything in the elements
- click validate => it should close the popup window
- save the object
You should get somthing like this:
Traceback (most recent call last):
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/modules/gui/main.py", line 1299, in _sig_child_call
    res = wid.handlers[button_name]()
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/modules/gui/window/form.py", line 304, in sig_save
    id = self.screen.save_current()
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/screen/screen.py", line 425, in save_current
    if self.current_model.validate():
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/model/record.py", line 182, in validate
    if not self.mgroup.mfields[fname].validate(self):
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/model/field.py", line 405, in validate
    if not model2.validate():
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/model/record.py", line 182, in validate
    if not self.mgroup.mfields[fname].validate(self):
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/model/field.py", line 407, in validate
    model.value[self.name].models.remove(model2)
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/model/group.py", line 68, in remove
    self.__screen.signal('record-changed', ('record-removed', idx))
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/signal_event.py", line 29, in signal
    fnct(self, signal_data, *data)
  File "/home/ls/Projets/OpenERP/v5.0/client/bin/widget/screen/screen.py", line 228, in _record_changed
    for view in self.views:
AttributeError: 'Screen' object has no attribute 'views'

Revision history for this message
Numérigraphe (numerigraphe) wrote :

I forgot to mention that this is using v5.0 branches from Launchpad.
Lionel.

Changed in openobject-client:
status: New → Confirmed
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Lionel,

   I have checked the problem it was a crucial one. Thank you for reporting.
   I would like to request you to apply the patch and notify us about the behavior.

Thank you.

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :
Changed in openobject-client:
assignee: nobody → Anup (Open ERP) (ach-openerp)
status: Confirmed → In Progress
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Lionel,

Would you please check this out?

Thank you.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Hi Jay,
I'll try ASP and let you know.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Jay, Anup, please excuse this late answer.

The patch you propose is good in that there is no more error in the client's stdout.
However there is a little problem remaining.

Please take the example module at lp:~numerigraphe/openobject-addons/bug479302, and reproduce the steps in comment #2 but don't save the record.
You'll notice that when you validate the popup and there are 6 empty lines, the client will remove 3 of them, and leaves the 3 others. In the main list view the column "elements" will show "(3)", and if double-click the row, the popup will show 3 empty lines.
If you then validate the popup again, 2 empty rows are removes but 1 still remains.

If you save the record however, all the empty lines are removed which is fine.

Could you please look into this mater ?
Thanks in advance,
Lionel.

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Lionel.

  We have checked the thing. The error will be raised only in case of missing mandatory fields. I would like to request you to check that filling up the mandatory fields it wont be raised.

Thank you.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hi,

It has been fixed by revision 1014 <email address hidden>.

Thank you.

Changed in openobject-client:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.