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

I have a field of type property, which does not recognize his method "on_change" is normal or not and whether there is another soluton. 

'standard_price': fields.property(type = 'float', groups="base.group_user")

<field name="standard_price" on_change="on_change_standard_price(standard_price, list_price)"/> 

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

what it's your problem?

Автор
... on_change don't work

give us your on_change function please

Автор

def on_change_standard_price(self, cr, uid, ids, standard_price, list_price, context=None): return {'value' : {'fieldx' : valuex,}}

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

Hello my friend:

Here is an example of an on_change function:

Python:

def on_change_declaration_id(self, cr, uid, ids, company_id, trimester, year, context=None):

res = {'value':{'declaration_ids': self.get_inputs(cr, uid, ids, company_id, trimester, year, context=context),

}

}

return res

XML:

<field name="trimester" on_change="on_change_declaration_id(company_id, trimester, year)">;

So that in your function:

def on_change_standard_price(self, cr, uid, ids, standard_price, list_price, context=None): return {'value' : {'standard_price' : valuex,}}

And check the structure of the value that you are giving to your field.

I am on your service if you need help ;)

Regards.

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

i know #Drees Far and is not the first time when i use onchange you can test in your system, fields.property don't accept onchange methode.

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

i know #Drees Far and is not the first time when i use onchange you can test in your system, fields.property don't accept onchange methode.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
серп. 25
3200
1
лип. 25
1392
1
серп. 25
1152
0
трав. 25
1774
2
квіт. 25
4002