Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10697 Lượt xem

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.




Ảnh đại diện
Huỷ bỏ

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

Tác giả

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.

Câu trả lời hay nhất

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.


Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 9 24
1348
0
thg 12 23
1290
0
thg 10 21
2893
1
thg 7 21
3641
0
thg 12 19
3273