c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #09077
[Bug 555271] Re: Number of ressources in osv.osv_memory object
On Sunday 04 April 2010, you wrote:
> Public bug reported:
>
> On a wizard based on two osv.osv_memory objects with one2many
> relationship, i canno't create more than 211 lines in the "many" object.
>
I will close this bug as "Invalid", because it is a feature of orm_memory
objects to have a hard limit on the number of records they can hold.
If you see at server/bin/osv/orm.py:2030 (latest trunk, more or less), you
will notice the "_max_count" member of the orm_memory objects. There is also a
"_check_time" one that means the limit is only enforced every so many calls to
self.create().
So, the absolute count of any orm_memory class is _max_count + _check_time -1
This, of course, applies to every class separately, not on aggregate.
If you need to have more data, define a class like:
class my_bigmem(osv.osv_memory):
_name = "foobar.big_mem"
_max_count = 1000 # or more..
In such a case, I would challenge your design decision to use an orm_memory
object for so many records. Why not a regular orm object after all? Memory
ones are volatile, you know..
** Changed in: openobject-server
Status: Confirmed => Invalid
--
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/555271
Title:
Number of ressources in osv.osv_memory object
Status in OpenObject Server:
Invalid
Bug description:
On a wizard based on two osv.osv_memory objects with one2many relationship, i canno't create more than 211 lines in the "many" object.
I want to do a "pre" import of many csv lines into the osv.osv_memory object before validating in the wizard and do the actual import in an osv.osv object.
i made a simple scenario to check if it was a bug :
from osv import fields,osv
class test_school(osv.osv_memory):
def _do_import(self, cr, uid, ids, context={}):
myself=self.browse(cr, uid, ids, context)[0]
for i in range(0,myself.size):
self.pool.get("test.person").create(cr, uid, {
"name":"Doe",
"age":i,
"school_id":myself.id
})
return True
_name = "test.school"
_columns = {
"name":fields.char("name",size=20),
"size":fields.integer("size"),
"students":fields.one2many("test.person","school_id","students"),
}
test_school()
class test_person(osv.osv_memory):
_name = "test.person"
_columns = {
"name":fields.char("name",size=20),
"age":fields.integer("age"),
"school_id":fields.many2one("test.school","school",ondelete="cascade"),
}
test_person()
This is a silly example but you can make tests with size over 211 : the number of lines will remains 211 (sometimes 201...) and only the last added lines will remain in the table...