From 6ccc1f96536c86085c621fc6c953cc2fed2f212f Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 22 Apr 2014 16:08:20 +0200 Subject: [PATCH] [FIX] stock_invoice_directly: made it work again bzr revid: qdp-launchpad@openerp.com-20140422140820-vmc7ua30u52ttp1b --- addons/stock_invoice_directly/__init__.py | 2 +- .../stock_invoice_directly.py | 50 +++++++++++++++++++ .../stock_invoice_directly/wizard/__init__.py | 24 --------- .../wizard/stock_invoice.py | 49 ------------------ 4 files changed, 51 insertions(+), 74 deletions(-) create mode 100644 addons/stock_invoice_directly/stock_invoice_directly.py delete mode 100644 addons/stock_invoice_directly/wizard/__init__.py delete mode 100644 addons/stock_invoice_directly/wizard/stock_invoice.py diff --git a/addons/stock_invoice_directly/__init__.py b/addons/stock_invoice_directly/__init__.py index 1631b934faf..7da3427374d 100644 --- a/addons/stock_invoice_directly/__init__.py +++ b/addons/stock_invoice_directly/__init__.py @@ -19,6 +19,6 @@ # ############################################################################## -import wizard +import stock_invoice_directly # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_invoice_directly/stock_invoice_directly.py b/addons/stock_invoice_directly/stock_invoice_directly.py new file mode 100644 index 00000000000..c4cccd6d17b --- /dev/null +++ b/addons/stock_invoice_directly/stock_invoice_directly.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import osv +from openerp.tools.translate import _ + + +class stock_picking(osv.osv): + _inherit = 'stock.picking' + + def do_transfer(self, cr, uid, picking_ids, context=None): + """Launch Create invoice wizard if invoice state is To be Invoiced, + after processing the picking. + """ + if context is None: + context = {} + res = super(stock_picking, self).do_transfer(cr, uid, picking_ids, context=context) + pick_ids = [p.id for p in self.browse(cr, uid, picking_ids, context) if p.invoice_state == '2binvoiced'] + if pick_ids: + context.update(active_model='stock.picking', active_ids=pick_ids) + return { + 'name': _('Create Invoice'), + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'stock.invoice.onshipping', + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': context + } + return res + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_invoice_directly/wizard/__init__.py b/addons/stock_invoice_directly/wizard/__init__.py deleted file mode 100644 index a175e30ec03..00000000000 --- a/addons/stock_invoice_directly/wizard/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import stock_invoice -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/stock_invoice_directly/wizard/stock_invoice.py b/addons/stock_invoice_directly/wizard/stock_invoice.py deleted file mode 100644 index 45f9f3bf9de..00000000000 --- a/addons/stock_invoice_directly/wizard/stock_invoice.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp.osv import fields, osv - -# class invoice_directly(osv.osv_memory): -# _inherit = 'stock.partial.picking' -# -# def do_transfer(self, cr, uid, ids, context=None): -# """Launch Create invoice wizard if invoice state is To be Invoiced, -# after processing the partial picking. -# """ -# if context is None: context = {} -# result = super(invoice_directly, self).do_transfer(cr, uid, ids, context) -# partial = self.browse(cr, uid, ids[0], context) -# context.update(active_model='stock.picking', -# active_ids=[partial.picking_id.id]) -# if partial.picking_id.invoice_state == '2binvoiced': -# return { -# 'name': 'Create Invoice', -# 'view_type': 'form', -# 'view_mode': 'form', -# 'res_model': 'stock.invoice.onshipping', -# 'type': 'ir.actions.act_window', -# 'target': 'new', -# 'context': context -# } -# return {'type': 'ir.actions.act_window_close'} - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: