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

For Odoo V8

I have a field.function in product.product model, depending on two fields one from product.template say "a" and one from product.product "b", also it has got an inverse function which is having no definition, which allows me to write the value manually in the field.function field.

Now when I try to delete the value of the field "b" it calls the field.function and calculates the field but also deletes the value of field "a" (field from product.template) . I am not getting why this is happening.

Can any one guide me please

 

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

In v8, instead of fields.function, we use the compute field and @api.depends if the field depends on some other fields and that can be dotted paths when using sub-fields.

A simple example:

name = fields.Char(string="Name")
upper = fields.Char(compute='_compute_upper', inverse='_inverse_upper')

@api.depends('name')
def _compute_upper(self):
for rec in self:
self.upper = self.name.upper() if self.name else False

def _inverse_upper(self):
for rec in self:
self.name = self.upper.lower() if self.upper else False

I can help you better if you tell me what exactly you want to do, like which are the fields or paste your code.

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

Thank you Akhil..

Did you solve the problem Hardik?

Hey Akhil i have another case which i need to execute the computed field each time there is an update in odoo field in setting another model without relation

Related Posts Відповіді Переглядів Дія
3
лют. 25
16662
1
лип. 16
4079
0
лип. 16
5029
1
груд. 15
3626
1
лист. 15
5106