Odoo Help

0

Custom BOOLEAN Field is neither TRUE nor FALSE initially, it only becomes TRUE when checked, and FALSE when unchecked. Why?

By
Carlos
on 5/16/16, 6:23 PM 995 views

When i click the print button  in quotations, my custom boolean fields show:

True (if the field was checked in sale order line) and nothing  if the field was not checked in sale order.

I need change this behavior for example if was checked: "The field was checked" and if not was checked: "he field was not checked".


Thank you.




What is the default value of your boolean field? Can you post the code you use to define it.

Bista Solutions US, Ray Carnes
on 5/16/16, 7:40 PM

models.py: ... need_product_red = fields.Boolean() ... templates.xml: ... ... report_saleorder_document (Here when print (PDF) i need show: a) If the user need product red must show a leyend "Send product red" (this mean that user checked the box) b) If the user do not need product red show a leyend "Do not send product red" (this mean that user do not checked the box) ... ... Actually when i print the quotations i get : True( if the user checked the box) and nothing if the user do not checked the box. I need to validate if the user check the box or not and write a message as the case.

Carlos
on 5/17/16, 12:58 PM
1
Anil R. Kesariya
On 5/17/16, 3:25 AM

Carlos,

Boolean field value by default is always False, when you create new record. if you haven't set any default on it, it's default feature.

But if you already have some records in the system for particular model and later you've added new Boolean field on that class/table, it will be neither False or True for previous/existing records. 

So,  you've to update those records by Query , value is null for those old records for the new Boolean field.

Hope, this might help.

Regards,

Anil.


Hi, i do not have old record, this is my code: models.py: ... need_product_red = fields.Boolean() ... templates.xml: ... ... report_saleorder_document (Here when print (PDF) i need show: a) If the user need product red must show a leyend "Send product red" (this mean that user checked the box) b) If the user do not need product red show a leyend "Do not send product red" (this mean that user do not checked the box) ... ... Actually when i print the quotations i get : True( if the user checked the box) and nothing if the user do not checked the box. I need to validate if the user check the box or not and write a message as the case

Carlos
on 5/17/16, 1:00 PM

This is Qweb feature it does not print False value in report part, you can simple add if condition in template Write Here for True Add one more condition for false part write here for if not true This is how it does work in Qweb part. hope this will help.

Anil R. Kesariya
on 5/18/16, 2:26 AM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 5/16/16, 6:23 PM
Seen: 995 times
Last updated: 9/13/17, 6:47 AM