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

I created a text field on our Quote form for my Sales Reps to input data from the customers quote request.  


This text field shows on the User side, however it does not print on the PDF sent to the customer.


I don't see any indicators that would permit/disable this.  Is there anything else I can do to make a text field that shows on the final PDF?

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

How do I store it in my database?  Sorry, I'm new to Odoo.

Hi Crystal C,

If you're using the backend, you can save a computed field value in the database by using the store=True parameter. By default, computed fields do not store values in the database unless specified. Here's an example:

python
Copy code
test_text = fields.Text('Text field', compute='_compute_test_text', readonly=False, store=True)
Make sure to add store=True in the field definition so the computed value will be stored in the database.

Let me know if you need further clarification!

Tác giả Câu trả lời hay nhất

Where/how do I edit it with the code you are referencing?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Do you have Odoo Studio?

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

Yes. And I am running Odoo 17

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

To show the custom text field in the PDF report, you need to add the field to the report template:

  1. Enable Developer Mode:
    • Go to Settings and activate Developer Mode.
  2. Find the Report Template:
    • Navigate to Technical > Reports > Reports.
    • Locate the report template for your Quote (e.g., sale.report_saleorder).
  3. Edit the Template:
    • Look for the XML template related to the report (e.g., sale_report_template.xml).
    • Add your custom field in the template. For example:
      Replace custom_field_name with the actual technical name of your field.
  4. Save and Test the PDF


FYI, To include your custom text field in the PDF report by extending the existing template from backend code, you need to inherit and extend the existing XML template.
Here is the code reference to help you:


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Crystal C,


You can easily print a text field in your PDF report, but please ensure that the text field is stored in your database. If it's not storable, you won't be able to print its value.


Thanks & Regards,

Name : Yahoo Baba

Email:  yahoobaba077@gmail.com

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 24
1545
2
thg 5 23
2493
0
thg 7 19
30
0
thg 8 18
5280
1
thg 3 16
5029