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

I habe a problem to change an existing boolen field to an computed boolean field:

class manatec_project_task_type(models.Model):
_inherit = 'project.task.type'

@api.one
def _get_value(self):
  print 'inside'
  self.value = True

  value = fields.Boolean(compute='_get_value') 

The field is visible on the form view but the method _get_value ist never called.


Regards

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

i'm changed value = fields.Boolean(compute='_get_value_get_value') to value = fields.Boolean(compute='_get_value'). This is how my code looks. It was just an copy and paste mistake.

أفضل إجابة

Ok my friend as i see in this link: http://odoo-new-api-guide-line.readthedocs.org/en/latest/fields.html 

We cant add a compute function to a boolean field.

You can do this:

Python:

def on_change_value_id(self, cr, uid, ids, field_name, context=None):
print ('------------------------test vente--------------------')
print field_name

 

Try this and tell me what you have got. Regards.

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

Where in the link do you see you can't add a compute function to a boolean field?

المنشورات ذات الصلة الردود أدوات العرض النشاط
8
أغسطس 15
16475
1
مارس 15
3144
2
يوليو 25
417
2
أغسطس 21
39122
2
أبريل 19
10033