mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] flake8 PEP8 for module account_cancel_check_voucher
This commit is contained in:
@@ -19,5 +19,3 @@
|
||||
##############################################################################
|
||||
|
||||
from . import account_invoice
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -18,18 +18,19 @@
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
"name" : "Cancel invoice, check on bank statement",
|
||||
"version" : "1.0",
|
||||
"depends" : ["base",
|
||||
"account",
|
||||
"account_voucher",
|
||||
"account_cancel",
|
||||
],
|
||||
"author" : "Camptocamp",
|
||||
"description": """Constraint forbidding to cancel an invoice already imported in bank statement with a voucher.
|
||||
"name": "Cancel invoice, check on bank statement",
|
||||
"version": "1.0",
|
||||
"depends": ["base",
|
||||
"account",
|
||||
"account_voucher",
|
||||
"account_cancel"],
|
||||
"author": "Camptocamp",
|
||||
"description": """
|
||||
Constraint forbidding to cancel an invoice already
|
||||
imported in bank statement with a voucher.
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'date' : [],
|
||||
'date': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import osv, orm
|
||||
|
||||
|
||||
class account_invoice(orm.Model):
|
||||
_inherit = "account.invoice"
|
||||
|
||||
@@ -37,19 +38,20 @@ class account_invoice(orm.Model):
|
||||
absl.name
|
||||
FROM account_bank_statement_line AS absl
|
||||
INNER JOIN account_bank_statement AS abs
|
||||
ON absl.statement_id = abs.id
|
||||
WHERE EXISTS (SELECT 1
|
||||
FROM account_voucher_line JOIN account_move_line ON
|
||||
(account_voucher_line.move_line_id = account_move_line.id)
|
||||
WHERE voucher_id=absl.voucher_id
|
||||
AND account_move_line.move_id = %s )""",
|
||||
(invoice['move_id'][0],))
|
||||
ON absl.statement_id = abs.id
|
||||
WHERE EXISTS (SELECT 1
|
||||
FROM account_voucher_line JOIN account_move_line ON
|
||||
(account_voucher_line.move_line_id = account_move_line.id)
|
||||
WHERE voucher_id=absl.voucher_id
|
||||
AND account_move_line.move_id = %s )""",
|
||||
(invoice['move_id'][0],))
|
||||
statement_lines = cr.dictfetchone()
|
||||
if statement_lines:
|
||||
raise osv.except_osv(_('Error!'),
|
||||
_('Invoice already imported in bank statment (%s) at %s on line %s'
|
||||
% (statement_lines['statement_name'],
|
||||
statement_lines['statement_date'],
|
||||
statement_lines['name'],)))
|
||||
raise osv.except_osv(
|
||||
_('Error!'),
|
||||
_('Invoice already imported in bank statment (%s) at %s on line %s'
|
||||
% (statement_lines['statement_name'],
|
||||
statement_lines['statement_date'],
|
||||
statement_lines['name'],)))
|
||||
|
||||
return super(account_invoice,self).action_cancel(cr, uid, ids, context=context)
|
||||
return super(account_invoice, self).action_cancel(cr, uid, ids, context=context)
|
||||
|
||||
Reference in New Issue
Block a user