Template Print Model Copies on Business Objects
A new feature allows creating a copy of a template print model for a specific business object.
To use this feature:
-
Add a many-to-one field
templatePrintModelon your business object domain:<many-to-one name="templatePrintModel" title="Template print model" ref="com.axelor.template.db.TemplatePrintModel"/> -
Add the field to your XML view:
<field name="templatePrintModel" domain="self.uploadStatus = 'ok' AND self.original = NULL AND self.templateSettings.model = :_xModelName"/> <field name="_xModelName" x-dirty="false" hidden="true"/> -
When
onLoadevent is triggered, call this action (after the actions already called by default):<action-record name="action-[modelName]-record-set-model-name" model="[model FQN]"> <field name="_xModelName" expr="eval: _model?.substring(_model?.lastIndexOf('.') + 1)"/> </action-record>Example for
Invoicemodel:<action-record name="action-invoice-record-set-model-name" model="com.axelor.apps.account.db.Invoice"> <field name="_xModelName" expr="eval: _model?.substring(_model?.lastIndexOf('.') + 1)"/> </action-record>The action name can be customized as needed.
-
Add a button to create the copy:
<button name="createCopyBtn" title="Copy" onClick="action-template-print-model-group-copy-template"/> -
Add the studio panel dashlet:
<panel-dashlet colSpan="12" height="800" action="action.template.print.model.view.generic.studio"/>
The field name must be templatePrintModel. Names, titles, and component sizes can be customized as needed.
|