Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Change Boolean field to Boolean(computed)

By
mh-manatec
on 9/8/15, 7:48 AM 1,517 views

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.

mh-manatec
on 9/8/15, 8:37 AM
0

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 9/8/15, 10:06 AM

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?

Leonardo Donelli
on 9/8/15, 10:09 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/8/15, 7:48 AM
Seen: 1517 times
Last updated: 9/8/15, 10:08 AM