Hello,
I update the patch on the issue [1] with only the engine to associate
the custom screen to an organizational party.
Don't hesitate to review and comment it ;)
Nicolas
[1] https://issues.apache.org/jira/browse/OFBIZ-10186,
On 23/01/2018 21:10, Nicolas Malin wrote:
Hi all,
Currently, I work on a pdf invoice creation for a personal project and
I wish go for this time to improve the printable document
configuration (like order pdf, invoice pdf, shipment pdf, and soon)
related to the organizational party that at its origin.
To realize it I started a POC where a add a new entity
PartyAcctgPrefTplDoc (maybe you have a better name) that associate an
organizational party (PartyAcctgPreference), a documentType
(invoiceType, orderType...) and a content.
The content return the screen to use (as blog concept) and the
standard document screen return the given screen or call the default
screen is empty.
With this improvement, you can create your own pdf template document
in your custom plugin with associate data and use it without any
framework modification.
More, if you have a specific case to rendering different document
following functional case, you can implement it on your screen.
Also, we can have a standard choice to rendering your document from a
content, manageable from PartyContent association.
The life isn't pretty ? (french expression, if you not understant,
just ignore it :)
Feel free if you have some remarks, I will create an issue for each
document type manageable by this concept to detail more this idea.
For example :
Content data
---------------------
<DataResource dataResourceId="MY_TPL_SALES_INV"
dataResourceTypeId="URL_RESOURCE" dataResourceName="My templage sales
invoice" mimeTypeId="application/pdf"
objectInfo="component://myplugin/widget/AccountingPrintScreens.xml#MyBeautyfullInvoicePDF"/>
<Content contentId="MY_TPL_SALES_INV" contentTypeId="DOCUMENT"
dataResourceId="MY_TPL_SALES_INV" contentName="My Beautyfull template
sales invoice with flowers"/>
<ContentPurposeType contentPusposeTypeId="INVOICE_TEMPLATE"
description="Content dedicate to rendering invoices"/>
<PartyAcctgPrefTplDoc partyId="Company"
invoiceTypeId="SALES_INVOICE" contentId="MY_TPL_SALES_INV"
fromDate="2000-01-01 00:00:00" />
----------------------
Standard screen
(application/accounting/widget/AccountinPrintScreens.xml)
-------------------------
<screen name="InvoicePDF">...
<actions><script
location="component://accounting/groovyScripts/invoice/GetInvoiceTemplateScreen.groovy"/></actions>
<widgets>
<include-screen name="${screenName}"
location="${screenLocation}"/>
</widgets>
</screen>
<screen name="DefaultInvoicePDF">
<section>.....
------------------------
GetInvoiceTemplateScreen.groovy return DefaultInvoicePDF screen if
didn't found any configuration for the invoice.partyIdFrom (for sales)
or invoice.partyId (for purchase)
Cheers,
Nicolas