← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 555271] Re: Number of ressources in osv.osv_memory object

 

On Monday 14 February 2011, you wrote:
> The default values have been changed to count=False (disabled, it used
> to be 200) and age=1.0 hour, so that with the default config the server
> will only expire osv_memory records...

Yes, but may I remind, Olivier, this simple design fact about osv_memory 
records:

   *** osv_memory records are VOLATILE, they are designed to be only temporary 
storage of data for the purposes of intermediate steps, like the wizards ***

we must keep that in mind[2] and never expect them to reliably _store_ data.
And this design fact does invalidate the proposals to have "orm_memory pointed 
to by plain orm records", or just have high limits etc.

My personal opinion is this: if we need to store some small amount[1] of 
wizard decisions, yes, orm_memory storage is appropriate. If we need to edit 
thousands of lines (which a human would take some hours to review), then we 
should reconsider and use some regular ORM model instead. If, like in the 
stock.partial.picking, we only use the list to display the set of records we 
are about to process (but don't expect the user to edit them all one-by-one), 
an orm_record may marginally be valid, though.


[1] a "small amount" can be subjective. In some cases 1-10 records, sometimes 
even 1000. 
[2] please don't hammer us describing that as a bug. It was designed to work 
that way and you have to understand that.

-- 
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 OpenERP Server:
  Fix Released

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...





References