Sale Product Document Default
Automatically include the product documents flagged by default in the quotation PDF.
The problem
The standard Sales PDF Quotation Builder can merge a product document into the quotation PDF when the document is configured with Sale : Visible at = Inside quote pdf. However the document is only a candidate: somebody has to open the Quote Builder tab of the quotation and tick it, line by line. Nothing is selected automatically, so a document meant to always travel with its product is silently left out of the PDF whenever the salesperson forgets the extra step, and it is always left out when the quotation is created by code: web services, AI agents, eCommerce or quotation templates.
Headers and footers coming from a quotation template are not affected: the standard module already propagates them.
The solution
An Add By Default flag on the product document, with the same semantics as the flag already available on quotation headers and footers. Documents carrying the flag are selected automatically on every order line using that product, both in the interface and on record creation, so the automation also covers web services, AI agent tools, eCommerce, lines generated from a quotation template and duplicated orders. The PDF composition itself is untouched: the standard module keeps merging the documents between the header pages and the quotation table.
Behaviour
| Where | What happens |
|---|---|
| Product, Documents tab, document form | New Add By Default checkbox, visible when Sale : Visible at is Inside quote pdf |
| Quotation line, product set from the interface | The flagged documents of the product or variant are ticked in the Quote Builder tab |
| Quotation line created by code | Same selection, without any interface interaction |
| Product changed on an existing line | Documents of the previous product are dropped, the new product's flagged documents are added |
| Manual selection already made | Preserved, the automatic selection is additive and never destructive |
| Document not set to Inside quote pdf | Never selected, the flag has no effect |
Fields
| Model | Field | Type | Description |
|---|---|---|---|
| product.document | add_by_default | Boolean | Add this document by default to the quotation lines using this product. Restricted to the sales user group, like the standard sales visibility field. |
Technical notes
- Single entry point — the selection logic lives in one helper on the sale order line, reused by the product onchange and by the create and write overrides.
- Bypass — pass skip_default_product_documents in the context to disable the automatic selection for a specific call.
- Duplication — duplicating an order line re-applies the flagged documents, so a manual removal does not survive a duplication.
- Tested — 8 automated tests cover the interface path, record creation, the product change and the bypass context.
Requirements
Odoo 19. Depends on the standard Sales PDF Quotation Builder application, which is installed automatically with Sales. Available in English and Italian.
Changelog
| Version | Notes |
|---|---|
| 19.0.1.0.0 | Add the Add By Default flag on product documents and the automatic selection of the flagged documents on the quotation lines, in the interface and on record creation. |
Developed by STeSI Consulting — Francesco Moccia <moccia.f@stesi.consulting>