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

Is it possible to use related field that it would only work one sided? For example let say there are two fields: field1 and field2:

'field2': fields.related('related_id', 'field1', type="float", string="Field 2")
'field1': fields.float('Field 1')

If this would be used, then doesn't matter which field would be changed, the other would change too. Is it possible to make that changing field1, field2 would change to field1 value, but changing field2, field1 wouldn't change?

Note. I think on_change method would not work here, because these fields are in different tables and in different views.

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

Wouldn't it be easier to add an onchange function to field1 to change field2. That way you have that one-sided behaviour you want, instantly.

And someone correct me if I am wrong, but related fields are one changed when you save the record. And even more... they do not show you the value stored on the database for that fields, but the related field they rely on, so be careful.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أكتوبر 21
3759
1
أكتوبر 18
15316
0
يناير 17
8176
1
أكتوبر 15
4415
1
مارس 15
31409