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_fiscal_position_vat_check
This commit is contained in:
@@ -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 <alexis.delattre@akretion.com> 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 <alexis.delattre@akretion.com>
|
||||
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 <alexis.delattre@akretion.com> 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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user