use context {'default_FIELD': ...} on action raise Integrity Error

Bug #516964 reported by Xavier ALT
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

  affects openobject-server

Version affected:
OpenObject Server 5.0 (stable) - lastest revision id

Steps to reproduce the problem:
1. Modify action related on menuitem Partner > Partner).
       Change context from {} to {'default_name': False}
       res.partner have field 'name' with required=True
2. Try to create a new partner.
3. It raise:
       Integrity Error
       ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne
« name »

Problem is, default_get() from orm_memory class is managing default
value correctly:

server/bin/osv/orm.py
...
1615 # get the default values from the context$
1616 for key in context or {}:$
1617 if key.startswith('default_') and (key[8:] in
fields_list):$
1618 value[key[8:]] = context[key]$
1619 return value$
...

But default_get() from orm class is not:

server/bin/osv/orm.py
...
2203 for key in context or {}:$
2204 if key.startswith('default_'):$
2205 value[key[8:]] = context[key]$
2206 return value$
...

See patch attached which fixed the problem for me :)

--
Xavier ALT
AJM Technologies S.A.
22, rue Goethe / L-1637 Luxembourg

Related branches

Revision history for this message
Xavier ALT (dex-phx) wrote :
Changed in openobject-server:
status: New → Confirmed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

It has been corrected by revision 1956 <email address hidden>.
Thank you for pointing out and the patch.

Changed in openobject-server:
status: Confirmed → 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.