How to add the standard print button to a list form
How to add the standard print button to a list form
Question: On many document list forms of 1C:Drive, such as on the list form of the “Goods issue” document, there exists the standard “Print” button. However, on some other lists forms, such as the “Subcontractor orders issued” document list form, this button is missing. How can I add this button to the list form of the “Subcontractor orders issued” document and add my own custom print forms to it as commands?
Answer: Print functionality in 1C:Drive is part of Standard Subsystems Library. In order to bring print functionality to the “Subcontractor orders issued” document:
In the PrintManagementOverridable common module exists the procedure OnDefineObjectsWithPrintCommands.
Add this procedure the line
ObjectsList.Add(Documents.SubcontractorOrderIssued);
When you are doing this in the extension, you could use the CallAfter directive.
Copy the Print and AddPrintCommands procedures from the GoodsIssue document manager module and paste them to SubcontractorOrderIssued document manager module.
In the SubcontractorOrderIssued document manager module, erase or comment unneeded commands and lines as shown in the screenshot. Change the names and presentation of the commands as you see fit.
Below it is shown how a default data processor for print output is tied to the code in the document’s manager module. You can copy this data processor for use as a starting point, then change its name, template and PrintForm function, reforming it to your custom print form.