c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #07977
[Bug 656747] Re: The function "Write" after new o2m record don't update form and don't be saved
class A(osv.osv):
_name="A"
def write(self, cr, uid, ids, vals, context=None):
eval = vals.get('b_ids', 0)
for item in eval:
vals['state_a'] = eval[i][2]['state_b']
return super(A, self).write(cr, uid, ids, vals, context)
_columns={
"name": fields.char('Name', size=25 ),
"b_ids": fields.one2many('B', 'a_id', 'Evals' ),
"state_a": fields.selection([("O","Open"), ("C","Close")], 'State'),
}
A()
class B(osv.osv):
_name='B'
_columns={
"name": fields.char('Name', size=25 ),
"a_id": fields.many2one('A'),
"state_b": fields.selection([("O","Open"), ("C","Close")], 'State'),
}
_defaults = {
'a_id': lambda self, cr, uid, context: context.get('a', False),
}
B()
-In the form of the A object i have a o2m grid with its B objects.
-Now i create a new B object from the grid.
-The write function of the A object is called and the new value of "state" is stored in the database but not displayed in the form.
-If i press the cancel button of the form the new value of the "state" field is displayed but if i press the save button the new value is deleted from the database and not displayed in the saved form.
This behavior does not happen in the GTK client.
** Changed in: openobject-client-web
Status: New => Invalid
** Converted to question:
https://answers.launchpad.net/openobject-client-web/+question/137748
--
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/656747
Title:
The function "Write" after new o2m record don't update form and don't be saved
Status in OpenObject Web Client:
Invalid
Bug description:
class A(osv.osv):
_name="A"
def write(self, cr, uid, ids, vals, context=None):
eval = vals.get('b_ids', 0)
for item in eval:
vals['state_a'] = eval[i][2]['state_b']
return super(A, self).write(cr, uid, ids, vals, context)
_columns={
"name": fields.char('Name', size=25 ),
"b_ids": fields.one2many('B', 'a_id', 'Evals' ),
"state_a": fields.selection([("O","Open"), ("C","Close")], 'State'),
}
A()
class B(osv.osv):
_name='B'
_columns={
"name": fields.char('Name', size=25 ),
"a_id": fields.many2one('A'),
"state_b": fields.selection([("O","Open"), ("C","Close")], 'State'),
}
_defaults = {
'a_id': lambda self, cr, uid, context: context.get('a', False),
}
B()
-In the form of the A object i have a o2m grid with its B objects.
-Now i create a new B object from the grid.
-The write function of the A object is called and the new value of "state" is stored in the database but not displayed in the form.
-If i press the cancel button of the form the new value of the "state" field is displayed but if i press the save button the new value is deleted from the database and not displayed in the saved form.
This behavior does not happen in the GTK client.