Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
10320 Переглядів

Hello

I inherit a class with _inherit in a models.Model construced class and define some extra fields and methods.

Now, I want to access a parent class field in a domain statment on one of those fields as well as in an @api.depends decorator.

However, i cannot figure out how to get access to those fields as thei are not available from within the class.

Note: within the method which is decorated with @api.depends, they are accessible normally, but on the identation level of the class itself theay are not... Please help, I can't figure it out even trying to decifer the core python files (models.py api.py fields.py)

Аватар
Відмінити
Автор

https://github.com/odoo/odoo/issues/1530

Найкраща відповідь

Both in domains and @api.depends statements, the fields always appear as strings. In other words, you never refer to the fields themselves, but instead you refer to their nameTherefore nothing special is needed to access inherited fields: the ORM knows how to resolve the field name.

Аватар
Відмінити
Найкраща відповідь

Ejemplo: 

 @ api.one

@api.depends('numero')

def _obtener_cliente(self):

para rec en auto:

Modelo = self.env [ 'bl']

bl = model.browse ([rec.no_bl.id])

rec.customers = bl.customers

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
лип. 15
10772
1
жовт. 15
9450
2
трав. 24
10667
0
черв. 23
78
6
січ. 18
32498