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

Has anyone figured out yet how and with which software to add the dynamic fields (like Sale Order Number) to the new v17 PDF quotation builder templates. The documentation does not explain this part. I have tried Libre Office to create a PDF form, making sure the name of the fields were corresponding to the ones mentioned in the docs. It sort of worked, but you could only see the auto populated value in the PDF after clicking on the empty field. And the field remains editable.

So how is this supposed to work? What do we need as software additionally to Odoo to build a template that show the fields populated and uneditable?

Edit: Tested a demo quote on demo.odoo.com for the Large Meeting Table. Downloaded the PDF and opened in Acrobat Reader. The Sales Order Number and Customer name only appear when clicking on the empty field. Also not there on the printed version. But if I open the PDF in Chrome browser it looks fine. This seems to be a PDF issue (lots of hits on Google)

So perhaps Libre Office still is a good way to build a quote template using open source software. So I will be testing some more. Also still need to figure out how to prevent the field from being editable after the PDF is generated.

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


i solved it with using adobe acrobat pro.
You just need to add a field with this button. Give it the correct name from the docs. And configure it with font/size.
As far as I tested, it only works with the 8 fields mentioned in the documentation of odoo. Other "__" notation are not working.

obd.digital

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

I’ve developed a module for adding custom fields to the quote builder in Odoo it has a ui and you can search fields to add. If you’re interested in learning more or have any questions, feel free to reach out to me on Discord. My Discord handle is tigor327#1233. Looking forward to connecting!

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

Can't reach u in discord. I want to print the company name instaed the name of the contact person. How to do that?

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

Hi! Since I'm not using Adobe Acrobat Pro and the trial is only 7 days - Is there any other software that gives you a possibility to add dynamic fields? I'm not a fan of paying €40 per month to have abilities to change one or two documents for customer ;) 

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

There are many open source PDF file builders, like html2pdf or fpdf2 and other similar tools.
If you can build a simple HTML page, you can deffinitely build a PDF with dinamic fields. 

Just pick up one that checks the most boxes for your needs.

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

Hello,
If you want to add custom fields (other than those defined in the docs), you can always update the ' _get_form_fields_mapping' function in the sale_pdf_quote_builder module.

from odoo import models

class IrActionReport(models.Model):
​_inherit = "ir.actions.report"

​def _get_form_fields_mapping(self, order, doc_line_id_mapping=None):
​res = super(IrActionReport, self)._get_form_fields_mapping(order, doc_line_id_mapping)​
​form_fields_mapping = {
​"your_new_field_label": order.your_new_field
​}
​res.update(form_fields_mapping)
​return res




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

Hi Christoph,
THX for that hint. But I can only update the whoole module. Ho to update _get_form_fields_mapping' function?
I want to print the company name instaed the name of the contact person.

Hi @Frank Tanneberger,
I've updated my answer.
You will need to add the function in one of your python file with inherit the ir.action.report class.

Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 5 25
2476
2
thg 5 25
5817
1
thg 3 25
1648
4
thg 3 25
4441
3
thg 2 25
5431