Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
2947 มุมมอง

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
3207
1
ก.ค. 25
1403
1
ส.ค. 25
1152
0
พ.ค. 25
1778
2
เม.ย. 25
4014