View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help


POS - Add reference product to a ticket line


Code snippet

Name: POS - Add reference product to a ticket line
Version: POS 2.30
Author: Andy Orencio (lodopidolo)

This article is an attempt on how to store the reference of an article as an attribute of the ticket line, to print on the receipt.


The method is:

<event key="ticket.addline" code="event.addline"/>
// Add product reference to a ticket line, y in the line is a product (discounts and others have no reference).
import com.openbravo.pos.forms.DataLogicSales; 
import com.openbravo.pos.ticket.ProductInfoExt; 
import com.openbravo.pos.ticket.TicketLineInfo;
Session session = new Session(database_url,  database_user, database_password); 
DataLogicSales logic = new DataLogicSales();
try {
	ProductInfoExt product = logic.getProductInfo(line.getProductID());
	line.setProperty("product.reference", product.getReference());
} catch (Exception e) {
	line.setProperty("product.reference", " ");
In this scriptlet you must replace database_url, database_user and database_password by their corresponding values.
${ticketline.getProperty("product.reference", "")}


        #foreach ($ticketline in $ticket.getLines())
            #if ($ticketline.isProductCom()) 
                <text align ="left" length="10">*${ticketline.printName()}</text>
                <text align ="left" length="10">${ticketline.printName()}</text>
            <text align ="right" length="5">x${ticketline.printMultiply()}</text>
            <text align ="right" length="25">${ticketline.getProperty("product.reference", "")}</text>
        #if ($ticketline.productAttSetInstId)
	        <text align ="left" length="40">    ${ticketline.productAttSetInstDesc}</text>


Retrieved from ""

This page has been accessed 11,774 times. This page was last modified on 3 January 2010, at 11:37. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.