[FIX] Correction regarding Nicolas Bessi - Camptocamp comments

This commit is contained in:
Vincent Renaville
2013-01-15 17:58:01 +01:00
parent 639bcf04d7
commit 3e7da5c393
3 changed files with 7 additions and 10 deletions

View File

@@ -17,6 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_invoice
from . import account_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -25,10 +25,7 @@
"description": """Constraint to not be able to cancel on invoice if already import in payment order
""",
'website': 'http://www.camptocamp.com',
'init_xml': [],
'update_xml': [
],
'demo_xml': [],
'data' : [],
'installable': True,
'active': False,
}

View File

@@ -37,14 +37,14 @@ class account_invoice(orm.TransientModel):
FROM payment_line as pl
INNER JOIN payment_order AS po
ON pl.id = order_id
WHERE move_line_id IN (SELECT id FROM account_move_line WHERE move_id = %s)""",
WHERE move_line_id IN (SELECT id FROM account_move_line WHERE move_id = %s) LIMIT 1""",
(invoice['move_id'][0],))
payment_orders = cr.dictfetchall()
payment_orders = cr.dictfetchone()
if payment_orders:
raise osv.except_osv(_('Error !'),
_("Invoice already import in payment"
"order (%s) at %s on line %s" %
(payment_orders[0]['payment_name'],
payment_orders[0]['payment_date'],
payment_orders[0]['name'],)))
(payment_orders['payment_name'],
payment_orders['payment_date'],
payment_orders['name'],)))
return super(account_invoice,self).action_cancel(cr, uid, ids, *args)