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.

1

What is left in my print pos invoice function on the POS web interface ?

By
GonG
on 6/15/14, 5:34 AM 1,104 views

Hi, I've been trying to print invoice directly from the POS interface. I managed to add print invoice button next to the next order button and some functionality to it. I've used the module tg_pos_enhanced developed by Thierry Godin. Therefore, the customer will set directly inside the POS onterface, so there is no problem with no selected customer.

All code below is works fine but it does not generate PDF invoice downloaded. Please help me, it seems very close to successfully print pos invoice directly from POS interface.

Here is the button function in javascript, it will active when I click on the print invoice button:

    var model = new instance.web.Model("pos.order");
    model.query(['id']).all().then(function(results) {
        posid = results[0].id;
        model.call("action_invoice", [[posid]], { context: new instance.web.CompoundContext({shadow:true}) })
                .then(function(result) {
                        console.log("Generate pos invoice WOO HOO!!!");
                });
       model.call("print_pos_invoice", [[posid]], { context: new instance.web.CompoundContext({shadow:true}) })
                .then(function(result) {
                        console.log("Print pos invoice WOO HOO!!!");
                });
       });

Here's the print_pos_invoice method in python:

def print_pos_invoice(self, cr, uid, ids, context=None):

        assert len(ids) == 1, 'This option should only be used for a single id at a time'
        datas = {
                 'model': 'pos.order',
                 'ids': ids,
                 'form': self.read(cr, uid, ids[0], context=context),
        }
        return {'type': 'ir.actions.report.xml', 'report_name': 'pos.invoice', 'datas': datas, 'nodestroy': True}

The console.log shows everything as expected. The last thing left is the generate PDF invoice is not downloaded. Could anyone help me accomplish this please?

did you get a solution for this? i am stuck up on the same thing. could you please help ? Thanks....

pranshu
on 9/3/14, 5:26 AM

I'm also stuck in this point, did you found the solution ?

Versão Integral, Anabela Damas
on 12/16/15, 11:18 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 6/15/14, 5:34 AM
Seen: 1104 times
Last updated: 3/16/15, 8:10 AM