From 0f2d2f5ae71f7482704159825b759274e30a80f6 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Thu, 10 Jul 2014 15:52:25 +0200 Subject: [PATCH] [FIX] flake8 PEP8 for module account_fiscal_position_vat_check --- .../__openerp__.py | 20 +++++++++++++------ .../account_invoice.py | 10 ++++++++-- account_fiscal_position_vat_check/partner.py | 13 +++++++++--- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/account_fiscal_position_vat_check/__openerp__.py b/account_fiscal_position_vat_check/__openerp__.py index 922468e80..c21244b6d 100644 --- a/account_fiscal_position_vat_check/__openerp__.py +++ b/account_fiscal_position_vat_check/__openerp__.py @@ -31,13 +31,21 @@ Check that the Customer has a VAT number on invoice validation ============================================================== -This module adds an option **Customer must have VAT** on fiscal positions. When a user tries to validate a customer invoice or refund with a fiscal position that have this option, OpenERP will check that the customer has a VAT number. If it doesn't, OpenERP will block the validation of the invoice and display an error message. +This module adds an option **Customer must have VAT** on fiscal positions. +When a user tries to validate a customer invoice or refund with a fiscal position +that have this option, OpenERP will check that the customer has a VAT number. -In the European Union (EU), when an EU company sends an invoice to another EU company in another country, it can invoice without VAT (most of the time) but the VAT number of the customer must be displayed on the invoice. +If it doesn't, OpenERP will block the validation of the invoice and display an error message. -This module also displays a warning when a user sets a fiscal position with the option **Customer must have VAT** on a customer and this customer doesn't have a VAT number in OpenERP yet. +In the European Union (EU), when an EU company sends an invoice to another EU company in another country, -Please contact Alexis de Lattre from Akretion for any help or question about this module. +it can invoice without VAT (most of the time) but the VAT number of the customer must be displayed on the invoice. + +This module also displays a warning when a user sets a fiscal position with the option + **Customer must have VAT** on a customer and this customer doesn't have a VAT number in OpenERP yet. + +Please contact Alexis de Lattre from Akretion + for any help or question about this module. """, 'author': 'Akretion', 'website': 'http://www.akretion.com', @@ -45,11 +53,11 @@ Please contact Alexis de Lattre from Akretion for 'data': [ 'account_fiscal_position_view.xml', 'partner_view.xml', - ], + ], 'images': [ 'images/fiscal_position_form.jpg', 'images/vat_check_invoice_validation.jpg', - ], + ], 'installable': True, 'active': False, 'application': True, diff --git a/account_fiscal_position_vat_check/account_invoice.py b/account_fiscal_position_vat_check/account_invoice.py index 543dd80a3..dc1bc54da 100644 --- a/account_fiscal_position_vat_check/account_invoice.py +++ b/account_fiscal_position_vat_check/account_invoice.py @@ -30,7 +30,9 @@ class account_fiscal_position(orm.Model): _columns = { 'customer_must_have_vat': fields.boolean( 'Customer Must Have VAT number', - help="If enabled, OpenERP will check that the customer has a VAT number when the user validates a customer invoice/refund."), + help="If enabled, OpenERP will check that the customer has a VAT number " + "when the user validates a customer invoice/refund." + ), } @@ -51,7 +53,11 @@ class account_invoice(orm.Model): type_label = _('a Customer Refund') raise orm.except_orm( _('Missing VAT number:'), - _("You are trying to validate %s with the fiscal position '%s' that require the customer to have a VAT number. But the Customer '%s' doesn't have a VAT number in OpenERP. Please add the VAT number of this Customer in OpenERP and try to validate again.") + _("You are trying to validate %s with the fiscal position '%s' " + "that require the customer to have a VAT number. " + "But the Customer '%s' doesn't have a VAT number in OpenERP." + "Please add the VAT number of this Customer in OpenERP " + " and try to validate again.") % (type_label, invoice.fiscal_position.name, invoice.partner_id.name)) return super(account_invoice, self).action_move_create( diff --git a/account_fiscal_position_vat_check/partner.py b/account_fiscal_position_vat_check/partner.py index c3daa2dff..dcac18e98 100644 --- a/account_fiscal_position_vat_check/partner.py +++ b/account_fiscal_position_vat_check/partner.py @@ -34,7 +34,14 @@ class res_partner(orm.Model): fp = self.pool['account.fiscal.position'].read( cr, uid, account_position, ['customer_must_have_vat', 'name']) if fp['customer_must_have_vat']: - return {'warning': { - 'title': _('Missing VAT number:'), - 'message': _("You have set the fiscal position '%s' that require the customer to have a VAT number. You should add the VAT number of this customer in OpenERP.") % fp['name']}} + return { + 'warning': { + 'title': _('Missing VAT number:'), + 'message': _( + "You have set the fiscal position '%s' " + "that require the customer to have a VAT number. " + "You should add the VAT number of this customer in OpenERP." + ) % fp['name'] + } + } return True