Skip to Content
Menu
This question has been flagged
2 Replies
9690 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.




Avatar
Discard

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

Author

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.

Best Answer

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.


Avatar
Discard
Author

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

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.

Related Posts Replies Views Activity
3
Sep 24
154
0
Dec 23
374
0
Oct 21
1796
1
Jul 21
2512
0
Dec 19
2439