Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to show company logo and customer details in POS ticket?

By
Yenthe
on 12/5/14, 10:49 AM 8,911 views

Hi everybody

I'd like to know how to modify the POS ticket. I know its in the point_of_sale module and that I have to edit the file under /static/src/xml/ and then edit the file pos.xml.
So far I've managed to add some details that I'd like etc but now my question is how do I get the logo from the company?
I've managed to hardcode it like this:

<img width="100"  hspace="20" src="/point_of_sale/static/src/img/logo.png" />

But I'd like to get the image from the database, being the logo from the company. 
By default the email etc is fetched by

<t t-esc="widget.pos.company.phone || ''"/>

But when I do this for the logo (<t t-esc="widget.pos.company.logo || ''"/>) nothing is printed. Can anybody tell me how to fix this?
As a second part I would also like to print out the details of the customer in the ticket (customer name, phone, address,..). How can I get those values on the ticket?

Thanks
Yenthe

What about company street, city, country?

Pascal Tremblay
on 3/17/15, 6:41 PM

Pascal the answer down here from Emipro explains how to get the street, city, .. First load in the model, add it to eh JS and then print it :)

Yenthe
on 3/18/15, 3:04 AM
4

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 12/8/14, 3:05 PM

@Yenthe

For printing the company logo

If you check the models.js, it has got an array called 'models' where it tries to load different models defined into the system, in that it includes the model 'res.company', where you can see it tries to fetch different fields of model 'res.company', but in that list it doesn't include the field 'logo'. So by inheritance or by changing the core code try to add the field 'logo' along with other fields of 'res.company' in it and under the pos-ticket template add the following line which will display the company logo on the receipt.

<div id="company_logo" style="text-align:center;"><img t-att-src="'data:image/png;base64,'+ widget.pos.company.logo" height="150px" width="150px"/></div>

Edited

For adding the customer details

go to the screen.js and go to the ReceiptScreenWidget, In there try to find the function "Refresh", below the line

var order = this.pos.get('selectedOrder');

Over there try to add the following code

            customer = order.get_client();
            var street = '';
            var city ='';
            var customer_name='';
            if (customer != undefined)
                {
                customer_name = customer.name;
                street = customer.street;
                city=customer.city;                
                }

            $('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{
                    widget:this,
                    order: order,
                    orderlines: order.get('orderLines').models,
                    paymentlines: order.get('paymentLines').models,
                    customer_name:customer_name,
                    customer_street:street,
                    city:city,
                }));

 

Now go to the template file and go to the "PosTicket" template, add the following lines below the value of shop

            customer name:<t t-esc="customer_name"/><br />
            customer street:<t t-esc="street"/><br />
            customer city:<t t-esc="city"/><br />

Hope this helps!!

@Emipro thanks for your reply! Sadly the solution does not seem to work as the image is not showing up.. I've added the field 'logo' in the models as you can see here: http://i.imgur.com/CDp6XFP.png and then I've added your block of code to the file pos.xml as you can see here: http://i.imgur.com/mUSvKkn.png and then I get this: http://i.imgur.com/bSfpG1j.png Am i missing something? And any idea how to get the customers data in the ticket too?

Yenthe
on 12/9/14, 3:27 AM

@Yenthe Actually at my side this thing works totally fine !!. What was your image format, can you try some other format the way you can see in the code "data:image/png;base64", try "gif,jpg". I tried again and it worked.

Emipro Technologies Pvt. Ltd.
on 12/10/14, 12:02 AM

@Empiro, you're right it does work! I set the company logo once again and then it was fixed.. Something probably glitched! Thank you very much for this. Could you also tell me how to add the customer his details? If you do I can accept this answer too, for now I've upvoted it. Thanks for the help!

Yenthe
on 12/10/14, 2:15 AM

@yenthe.. I think you mean that whatever customer is been selected for an order, you need the information of that customer to be printed in the receipt. If yes, then let me check it out. I will let you know.

Emipro Technologies Pvt. Ltd.
on 12/10/14, 3:09 AM

@Empiro, thats correct! You can select a customer for a session and set this person as the customer (see http://i.imgur.com/EyIaFu3.png). I want to print the customer his name, address, ... etc out on the ticket too! So far I found out there should be logic added to models.js as there isn't anything sending it to the XML, but I'm not sure how.

Yenthe
on 12/10/14, 3:31 AM

@Empiro, have you found any solution for this? I haven't had any succes for now..

Yenthe
on 12/18/14, 6:25 AM

@Yenthe.... Sorry I didn't got chance to look into this. If you can wait till this Saturday then I can try something.

Emipro Technologies Pvt. Ltd.
on 12/18/14, 6:35 AM

@Emipro did you manage to find a solution? I'm still looking for this but I haven't found myself any solution yet :(

Yenthe
on 12/22/14, 10:28 AM

@Yenthe I have added the code for showing the customer details in pos receipt, please have a look at it and let me know if that works or not.

Emipro Technologies Pvt. Ltd.
on 12/23/14, 3:16 PM

This works like a charm! Thank you very much Emipro, I've both upvoted and accepted the answer! Wish I could upvote this 10 times.

Yenthe
on 12/24/14, 2:14 AM
0
Daniel Holden
On 12/1/16, 12:01 PM

I am using version 8. I attempted the solution in this thread, but I see absolutely no change to the POS ticket.

I edited: openerp/addons /point_of_sale/static/src/js/models.js

openerp/addons /point_of_sale/static/src/xml/pos.xml

openerp/addons /point_of_sale/static/src/js/screen.js

..as instructed above.

My POS ticket still looks like this:



Is there a step that I missed?

0
Daniel Holden
On 12/1/16, 12:01 PM

I am using version 8. I attempted the solution in this thread, but I see absolutely no change to the POS ticket.

I edited: openerp/addons /point_of_sale/static/src/js/models.js

openerp/addons /point_of_sale/static/src/xml/pos.xml

openerp/addons /point_of_sale/static/src/js/screen.js

..as instructed above.

My POS ticket still looks like this:



Is there a step that I missed?

0
Daniel Holden
On 12/1/16, 12:00 PM

I am using version 8. I attempted the solution in this thread, but I see absolutely no change to the POS ticket.

I edited: openerp/addons /point_of_sale/static/src/js/models.js

openerp/addons /point_of_sale/static/src/xml/pos.xml