c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #17387
[Bug 686795] Re: Can not create custom field hr.employee many2one v.5.0.15
Hello Tanel,
Thanks for the bug report.
I would say, this is not a bug, it comes due to wrong configuration. You could have selected 'set null' here.
Anyways, the actual problem resides in the selection widget of web
client. The selection widget adds a blank option to the 'not required'
selection field's select list. Thus making an additional '' to the
selection.
I have attached a patch which makes you get rid of this problem.
We won't accept it as a bug for 5.0,this has been well managed in
version 6.0.
Thanks for understanding and thanks for your patience.
** Patch added: "selection_blank.patch"
https://bugs.launchpad.net/openobject-addons/5.0/+bug/686795/+attachment/1868537/+files/selection_blank.patch
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/686795
Title:
Can not create custom field hr.employee many2one v.5.0.15
Status in OpenERP Modules (addons):
Invalid
Status in OpenERP Addons 5.0 series:
Won't Fix
Status in OpenERP Addons trunk series:
Invalid
Bug description:
I describe how you can reproduce that bug step by step. Tested with 3
computers. 2 Linux and 1 Win.
So lets start.
1. Open in Openerp-Web
CRM & SRM ->After-Sale Services->Bug Tracking->New Bug
2. Now lets make new custom field "Employee"
[CUSTOMISE]-> CUSTOMISE OBJECT-> Create new record.
3. Lets fill that new record.
Name: x_employee_id
Field Label: Employee
Field Type: many2one
Object Relation: hr.employee
On delete: (clear, remove Set NULL)
4. Press button "Save" and u see results:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/openerp-server/netsvc.py", line 299, in dispatch
result = LocalService(service_name)(method, *params)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/netsvc.py", line 77, in __call__
return getattr(self, method)(*params)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/addons/base_module_record/base_module_record.py", line 38, in execute
res = super(recording_objects_proxy, self).execute(*args, **argv)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/service/web_services.py", line 577, in execute
res = service.execute(db, uid, object, method, *args)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/osv/osv.py", line 58, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/osv/osv.py", line 119, in execute
res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/osv/osv.py", line 111, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/addons/base/ir/ir_model.py", line 77, in write
return super(ir_model,self).write(cr, user, ids, vals, context)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/osv/orm.py", line 2679, in write
result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
File "/usr/local/lib/python2.6/dist-packages/openerp-server/osv/fields.py", line 446, in set
id_new = obj.create(cr, user, act[2], context=context)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/addons/base/ir/ir_model.py", line 271, in create
self.pool.get(vals['model'])._auto_init(cr, ctx)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/osv/orm.py", line 1866, in _auto_init
cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (self._table, k, ref, f.ondelete))
File "/usr/local/lib/python2.6/dist-packages/openerp-server/sql_db.py", line 78, in wrapper
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/sql_db.py", line 123, in execute
res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "None"
LINE 1: ...EY ("x_employee_id") REFERENCES "hr_employee" ON DELETE None
^
NOTICE: If you not see that bug then please make new database and try again. I noticed when i first put something else when hr.employee and save and then replace it with hr.employee then bug dis asper!
So create NEW database and you see that bug 100%.
Another notice. If you once reproduced that bug you can not use many2one anymore at all! Always is result crash!
References