0

I have an object a that inherits from object b

 class b(models.Model):
    x = fields.Char(string="x")
    y = fields.Char(string="y")

 class a(models.Model):
    _inherit = ['b']
    @api.model 
    def method(self, cr, uid, context=None): 
        valueofx=self.x 
        valueofy=self.y

I want to access to a value field of the class b from class a
I'm using this syntax..

     valueofx=self.x
     valueofy=self.y

The value of x and y is null / None. What's wrong ?

Caludio
  • 135
  • 11
  • 1
    You're not giving any context to your question, can you show the full code of the method? – yorodm Sep 27 '18 at 14:48
  • this is the method using the api model @api.model def method(self, cr, uid, context=None): valueofx=self.x valueofy=self.y – Caludio Sep 27 '18 at 14:56
  • 1
    `@api.model` doesn't guarantee you have a valid record, you shold read [this](https://stackoverflow.com/questions/31112660/what-is-different-b-w-api-one-api-multi-and-api-model). You should also edit your question to include the method. – yorodm Sep 27 '18 at 15:00
  • it works with api multi thnks – Caludio Sep 27 '18 at 15:22

0 Answers0