تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
7868 أدوات العرض

I have a function on_change in a Treeview (editable="bottom"):

Example:

Product Name | Qty.(onchange) | Unit Cost(onchange) | Total (readonly)

Product1 | 3.00 | 512.00 | 1536.00

*The problem is when i try to save after on_change, the field [Total] which is a readonly gets cleared/disappear. Just found out that when you set it to readonly=False the value of [Total] remains.

*Is there any method to lock the field rather than setting it to readonly=True? *Or it's still a bug from OpenERP 6.1?

الصورة الرمزية
إهمال

You can inherit create and write methods to save the value on Total

أفضل إجابة

As far as I know readonly fields are not sent to server. You may set an invisible field with the correct value and a related field to display readonly value.

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Thanks nbessi, now I know somehow its a bug from 6.1

الصورة الرمزية
إهمال

I also want to know using related field how to use in same table ? Example: fields.related(?, 'total', type='float', relation='current.table', string='Total', store=True),

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
سبتمبر 21
5602
4
ديسمبر 23
20899
2
أبريل 20
13312
0
أبريل 17
3483
1
سبتمبر 15
3875