Se rendre au contenu
Menu
Cette question a été signalée
5 Réponses
3737 Vues

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.

Avatar
Ignorer
Meilleure réponse


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

Avatar
Ignorer
Meilleure réponse

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!

Avatar
Ignorer

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

Meilleure réponse

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 ;) 

Avatar
Ignorer
Meilleure réponse

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.

Avatar
Ignorer
Meilleure réponse

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




Avatar
Ignorer

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.

Publications associées Réponses Vues Activité
4
mai 25
2429
2
mai 25
5764
1
mars 25
1612
4
mars 25
4405
3
févr. 25
5383