You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Ingo Wolfmayr (Jira)" <ji...@apache.org> on 2022/04/21 09:30:00 UTC

[jira] [Updated] (OFBIZ-5759) Multiple invoice templates

     [ https://issues.apache.org/jira/browse/OFBIZ-5759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ingo Wolfmayr updated OFBIZ-5759:
---------------------------------
    Attachment: InvoiceTemplate.patch

> Multiple invoice templates
> --------------------------
>
>                 Key: OFBIZ-5759
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5759
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: accounting
>    Affects Versions: Trunk, Upcoming Branch
>            Reporter: Nicolas Malin
>            Priority: Minor
>              Labels: invoice, template
>         Attachments: InvoiceTemplate.patch
>
>
> Open this issue behind discussion on user mailing list :
> http://ofbiz.markmail.org/message/rtrxzvlozlnribye?q=multiple+invoice+template to keep in mind and/or if some people is interested to contribute ;)
> {quote} I am looking for a way to add additional invoice templates without changing to much of the original ofbiz code if possible.
> The case: - multiple unrelated companies - multi tenant environment - multiple invoice layouts 
> {quote}
>  When I have this case on a projet, I use the content system to load the template.
> Example : Store a default template for each organization or a template specific by some customer. 
>  * Create PartyContentType : INVOICE_TEMPLATE 
>  * Load your templates en Content 
>  * Associate your content to each organization in ofbiz 
>  * if a customer have a specific template associate it
> On your InvoicePDF screen resolve the template by a groovy script : {code:java}
>  //resolve if customer template is present 
> partyContents = delegator.findByAndCache("PartyContent", [partyId : invoice.partyId]) 
> if (partyContents) partyContents = EntityUtil.filterByDate(partyContents, invoice.invoiceDate) 
> if (partyContents) partyContent = partyContents[0]
> if (!partyContent) { //resolve if organization hasa template 
>     partyContents = delegator.findByAndCache("PartyContent", [partyId : invoice.partyIdFrom]) 
>     if (partyContents) partyContents = EntityUtil.filterByDate(partyContents, invoice.invoiceDate) 
>     if (partyContents) partyContent = partyContents[0]
>  }
>  {code}
>  Warn, I wrote the code on the fly, maybe it doesn't contains the absolute true ;)
> Now you have a content, you can resolve your flow has you want (ftl injection, content service to renderer string), etc .... 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)