Skip to Content
Menu
This question has been flagged
2000 Views

We have extended the module res.partner. We have added a field after the email, and added a method on_change on this new field. In the method on_change it create an instance of a TransientModel class, and when it make the method self.env['test.classì].create({}), odoo set to null the fields related to retail Accounting.
How to help me understand the reason of this behavior?

code: 

# -*- coding: utf-8 -*-
from openerp import models, fields, api
class res_partner(models.Model):
_inherit = 'res.partner'
test = fields.Char(string='Test')
@api.onchange('test')
@api.one
def onchange_test(self):
p = self.env['test.class'].create({})
p.a = "test"
return

class test_class(models.TransientModel):
_name = "test.class"
a = fields.Char()
b = fields.Char()


Avatar
Discard