Quantcast
Channel: OpenERP Help - Individual question feed
Viewing all articles
Browse latest Browse all 69

error creating and saving records?

$
0
0
I was trying to create a record with a few required fields in an editable tree view of a one2many field. If I entered a record correctly and saved it, the creating and saving of the record were always OK. But, if I accidentally missed one or few required fields when creating a new record, I received warning messages, which was fine to this point. Then, I entered the missed required fields and saved the record. Then, multiple same records (normally the same number of the warning messages) were saved in the tree view, which was definitely wrong, because I only entered one record in the tree view. I checked the record in the postgresql database. Yes, there were multiple same records. I also traced the create function. of model. Yes, it was called multiple times and each time it added a same record. The problem only occurs within the tree view of a one2many field. No problem with a normal tree view on normal fields. How could this problem happen? Is there a fix or is it a bug of openerp v7? ======== lgp_testing.py ========
from openerp.osv import osv
from openerp.osv import fields
class lgp_testing(osv.osv):
    _name = 'lgp.testing'
    _description = u'testing'
    _columns = {
        'name': fields.char(u'name', size=60, required=True),
        'detail': fields.one2many('lgp.testingdetails', 'name', u'detail'),
    }
lgp_testing()
class lgp_testingdetails(osv.osv):
    _name = 'lgp.testingdetails'
    _description = u'testingdetails'
    _columns = {
        'name': fields.many2one('lgp.testing', u'name', ondelete='no action'),
        'val': fields.char(u'val', size=100, required=True),
        'date': fields.date(u'date', required=True),
    }
lgp_testingdetails()

======== lgp_testing_view.xml ========
testinglgp.testing
testinglgp.testingtestinglgp.testingformtree,form

Viewing all articles
Browse latest Browse all 69

Trending Articles