Odoo Help


print invoices in stock.picking.out tree [Closed]

Wolfgang Pichler
on 3/4/14, 12:19 PM 2,394 views

The Question has been closed

Ray Carnes
on 03/08/2014 20:42:15

Hello everybody,

i want to be able to print invoices which are linked using the sale_id from the stock.picking.out tree print menu.

I have already managed to get it print the invoice from the form by extending the stock_picking_out form with this function

class stock_picking_out(osv.osv):
_name = 'stock.picking.out'
_inherit = 'stock.picking.out'
def action_print_invoice(self, cr, uid, ids, context=None):
    invoice_ids = []
    _logger.info('self: %s', repr(self))
    _logger.info('ids: %s', repr(ids))
    for picking in self.pool.get("stock.picking.out").browse(cr, uid, ids):
        for invoice in picking.sale_id.invoice_ids:
    return self.pool.get('account.invoice').invoice_print(cr, uid, invoice_ids)

I have tried to create a server action ir.actions.server with this code :action = self.action_print_invoice(cr, uid, [object.id]) - and to link it with this to a print button.

the server action does get executed - but it does not do what i wanted to do...

Is there any simple way to achive this ?

Wolfgang Pichler
On 3/5/14, 4:41 AM

Hello everybody,

i figured it out on my own - for the record - here the way which worked for me...

  • create a wizard (a simple form with nothing else then a cancel and a print button, a osv.TransientModel with the print action function for the button)
  • the print action function does create the response - and thats it...

    class stock_picking_out_invoices(osv.TransientModel):
    def print_invoices(self, cr, uid, ids, context=None):
        _logger.info('self: %s', repr(self))
        _logger.info('ids: %s', repr(ids))
        _logger.info('context: %s', repr(context))
        invoice_ids = []
        if ('active_ids' in context) and ('active_model' in context):
            for picking in self.pool.get(context['active_model']).browse(cr, uid, context['active_ids']):
                if (picking.sale_id.invoice_ids):
                    for invoice in picking.sale_id.invoice_ids:
        _logger.info('invoice_ids: %s', repr(invoice_ids))
        datas = {
            'ids': invoice_ids,
            'model': 'account.invoice',
            'form': []
        return {
            'type': 'ir.actions.report.xml', 
            'report_name': 'account.invoice', 
            'datas': datas


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 3/4/14, 12:19 PM
Seen: 2394 times
Last updated: 3/16/15, 8:10 AM