Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
1391 Weergaven

EN :

I created this file in order to add a field when generating PDFs linked to the quote, only nothing happens, no error, nothing... I use Odoo 17

If anyone has a clue to help me.

Thanks in advance.

Fabien 

File linked by inheritance :
addons/
sale_pdf_quote_builder/
models/
ir_actions_report.py
My model :
from odoo import models, api

class CustomReport(models.Model):
    _inherit = 'ir.actions.report'

    @api.model
    def _get_form_fields_mapping(self, order):
        # Votre logique personnalisée ici
        form_fields_mapping = super(CustomReport, self)._get_form_fields_mapping(order)
        form_fields_mapping['date_order'] = 'test'  # Ajout de votre champ personnalisé
        return form_fields_mapping
Avatar
Annuleer
Auteur Beste antwoord

For those who encounter my problem, I have the solution:


For your model to work and therefore be taken into account, you must add a dependency, here 'sale_pdf_quote_builder' in the __manifest__.py. This allows your model to be loaded after the dependency.


If you want to add fields for filling PDF, add your fields with the field name (Dynamic text in PDF), regarding the module:

# ir_actions_report.py

from odoo import models, api
class IrActionsReport(models.Model):
​_inherit = 'ir.actions.report'

​@api.model
​def _get_form_fields_mapping(self, order, doc_line_id_mapping=None):
​form_fields_mapping = super()._get_form_fields_mapping(order, doc_line_id_mapping=doc_line_id_mapping)
​form_fields_mapping.update({
​'signed_on': order.signed_on,
​'signed_by': order.signed_by,})
​return form_fields_mapping



Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
jul. 25
499
2
jul. 25
752
1
jul. 25
589
1
jul. 25
583
2
jul. 25
597