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

--
logoNrd <https://nereide.fr/>
        Nicolas Malin
The apache way <http://theapacheway.com/> : *Charity* Apache’s mission is providing software for the public good.
[email protected]
8 rue des Déportés 37000 TOURS, 02 47 50 30 54

Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way <http://theapacheway.com/>|réseau LE <http://www.libre-entreprise.org/>

Reply via email to