From 35944df467ed24b1e7ff9fffe2261cb198b39f9c Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 31 Jan 2019 23:21:17 +0100 Subject: [PATCH] MIG account_fiscal_position_vat_check from v10 to v12 --- account_fiscal_position_vat_check/__init__.py | 2 -- account_fiscal_position_vat_check/__manifest__.py | 10 +++++----- account_fiscal_position_vat_check/models/__init__.py | 2 -- .../models/account_invoice.py | 8 ++++---- account_fiscal_position_vat_check/models/partner.py | 6 +++--- account_fiscal_position_vat_check/readme/CONFIGURE.rst | 3 +++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 8 ++++++++ account_fiscal_position_vat_check/readme/USAGE.rst | 3 +++ .../views/account_fiscal_position.xml | 3 ++- 10 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 account_fiscal_position_vat_check/readme/CONFIGURE.rst create mode 100644 account_fiscal_position_vat_check/readme/CONTRIBUTORS.rst create mode 100644 account_fiscal_position_vat_check/readme/DESCRIPTION.rst create mode 100644 account_fiscal_position_vat_check/readme/USAGE.rst diff --git a/account_fiscal_position_vat_check/__init__.py b/account_fiscal_position_vat_check/__init__.py index cde864bae..0650744f6 100644 --- a/account_fiscal_position_vat_check/__init__.py +++ b/account_fiscal_position_vat_check/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import models diff --git a/account_fiscal_position_vat_check/__manifest__.py b/account_fiscal_position_vat_check/__manifest__.py index 1e0234efe..e06f77a09 100644 --- a/account_fiscal_position_vat_check/__manifest__.py +++ b/account_fiscal_position_vat_check/__manifest__.py @@ -1,15 +1,15 @@ -# -*- coding: utf-8 -*- -# © 2013-2016 Akretion (Alexis de Lattre ) +# Copyright 2013-2019 Akretion France (https://akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Account Fiscal Position VAT Check', - 'version': '10.0.1.0.0', - 'category': 'Accounting & Finance', + 'version': '12.0.1.0.0', + 'category': 'Invoices & Payments', 'license': 'AGPL-3', 'summary': 'Check VAT on invoice validation', 'author': "Akretion,Odoo Community Association (OCA)", - 'website': 'http://www.akretion.com', + 'website': 'https://github.com/OCA/account-financial-tools', 'depends': ['account', 'base_vat'], 'data': [ 'views/account_fiscal_position.xml', diff --git a/account_fiscal_position_vat_check/models/__init__.py b/account_fiscal_position_vat_check/models/__init__.py index d8b42d60d..eca73eb14 100644 --- a/account_fiscal_position_vat_check/models/__init__.py +++ b/account_fiscal_position_vat_check/models/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- - from . import account_invoice from . import partner diff --git a/account_fiscal_position_vat_check/models/account_invoice.py b/account_fiscal_position_vat_check/models/account_invoice.py index ba616a59f..7e7031ddc 100644 --- a/account_fiscal_position_vat_check/models/account_invoice.py +++ b/account_fiscal_position_vat_check/models/account_invoice.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- -# © 2013-2016 Akretion (Alexis de Lattre ) +# Copyright 2013-2019 Akretion France (https://akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api, _ +from odoo import api, models, _ from odoo.exceptions import UserError @@ -25,5 +25,5 @@ class AccountInvoice(models.Model): "a VAT number in Odoo. Please add the VAT number of this " "Customer in Odoo and try to validate again.") % ( invoice.fiscal_position_id.name, - invoice.partner_id.name_get()[0][1])) + invoice.partner_id.display_name)) return super(AccountInvoice, self).action_move_create() diff --git a/account_fiscal_position_vat_check/models/partner.py b/account_fiscal_position_vat_check/models/partner.py index a02f68669..a45d1ffc4 100644 --- a/account_fiscal_position_vat_check/models/partner.py +++ b/account_fiscal_position_vat_check/models/partner.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- -# © 2013-2016 Akretion (Alexis de Lattre ) +# Copyright 2013-2019 Akretion France (https://akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api, _ +from odoo import api, models, _ class ResPartner(models.Model): diff --git a/account_fiscal_position_vat_check/readme/CONFIGURE.rst b/account_fiscal_position_vat_check/readme/CONFIGURE.rst new file mode 100644 index 000000000..c7845cb81 --- /dev/null +++ b/account_fiscal_position_vat_check/readme/CONFIGURE.rst @@ -0,0 +1,3 @@ +To configure this module, go to the menu *Invoicing > Configuration > Accounting +> Fiscal Positions* and enable the option **VAT Required** on the relevant +fiscal positions. diff --git a/account_fiscal_position_vat_check/readme/CONTRIBUTORS.rst b/account_fiscal_position_vat_check/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ff65d68ce --- /dev/null +++ b/account_fiscal_position_vat_check/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Alexis de Lattre diff --git a/account_fiscal_position_vat_check/readme/DESCRIPTION.rst b/account_fiscal_position_vat_check/readme/DESCRIPTION.rst new file mode 100644 index 000000000..088a0172a --- /dev/null +++ b/account_fiscal_position_vat_check/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +With this module, when a user tries to validate a customer invoice or refund +with a fiscal position that requires VAT, Odoo blocks the validation of the invoice +if the customer doesn't have a VAT number in Odoo. + +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. diff --git a/account_fiscal_position_vat_check/readme/USAGE.rst b/account_fiscal_position_vat_check/readme/USAGE.rst new file mode 100644 index 000000000..cef216cd6 --- /dev/null +++ b/account_fiscal_position_vat_check/readme/USAGE.rst @@ -0,0 +1,3 @@ +On the customer form view, Odoo will display a warning when a user sets +a fiscal position that has the option **VAT Required** on a customer +that doesn't have a VAT number yet. diff --git a/account_fiscal_position_vat_check/views/account_fiscal_position.xml b/account_fiscal_position_vat_check/views/account_fiscal_position.xml index d5e793752..9f61d938e 100644 --- a/account_fiscal_position_vat_check/views/account_fiscal_position.xml +++ b/account_fiscal_position_vat_check/views/account_fiscal_position.xml @@ -1,6 +1,7 @@