From c484d26df9bf1859dde1703023253f718884f8d8 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Fri, 17 Apr 2015 08:54:50 +0200 Subject: [PATCH 1/5] [ADD] website_sale_vat_required --- website_sale_vat_required/README.rst | 28 +++++++++++++ website_sale_vat_required/__init__.py | 21 ++++++++++ website_sale_vat_required/__openerp__.py | 39 ++++++++++++++++++ .../controllers/__init__.py | 21 ++++++++++ website_sale_vat_required/controllers/main.py | 29 +++++++++++++ .../static/description/icon.png | Bin 0 -> 1950 bytes .../website_order_view.xml | 10 +++++ 7 files changed, 148 insertions(+) create mode 100644 website_sale_vat_required/README.rst create mode 100644 website_sale_vat_required/__init__.py create mode 100644 website_sale_vat_required/__openerp__.py create mode 100644 website_sale_vat_required/controllers/__init__.py create mode 100644 website_sale_vat_required/controllers/main.py create mode 100644 website_sale_vat_required/static/description/icon.png create mode 100644 website_sale_vat_required/website_order_view.xml diff --git a/website_sale_vat_required/README.rst b/website_sale_vat_required/README.rst new file mode 100644 index 0000000000..b4a8af0243 --- /dev/null +++ b/website_sale_vat_required/README.rst @@ -0,0 +1,28 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +e-commerce required VAT +====================== + +This module extends checkout e-commerce form in order to force user to fill 'VAT number' field + + +Contributors +------------ + +* Lorenzo Battistini + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/website_sale_vat_required/__init__.py b/website_sale_vat_required/__init__.py new file mode 100644 index 0000000000..1995a97ec7 --- /dev/null +++ b/website_sale_vat_required/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Agile Business Group sagl () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import controllers diff --git a/website_sale_vat_required/__openerp__.py b/website_sale_vat_required/__openerp__.py new file mode 100644 index 0000000000..8cdf2a67d7 --- /dev/null +++ b/website_sale_vat_required/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Agile Business Group sagl () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'e-commerce required VAT', + 'summary': 'VAT number required in checkout form', + 'version': '8.0.1.0.0', + 'category': 'Website', + 'author': "Agile Business Group,Odoo Community Association (OCA)", + 'website': 'http://www.agilebg.com', + 'license': 'AGPL-3', + 'depends': [ + 'website_sale', + ], + 'data': [ + 'website_order_view.xml', + ], + 'qweb': [ + ], + 'installable': True, + 'auto_install': False, +} diff --git a/website_sale_vat_required/controllers/__init__.py b/website_sale_vat_required/controllers/__init__.py new file mode 100644 index 0000000000..92b004c9f0 --- /dev/null +++ b/website_sale_vat_required/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2015 Lorenzo Battistini +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import main diff --git a/website_sale_vat_required/controllers/main.py b/website_sale_vat_required/controllers/main.py new file mode 100644 index 0000000000..a33f516708 --- /dev/null +++ b/website_sale_vat_required/controllers/main.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Agile Business Group sagl () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.addons.website_sale.controllers.main import website_sale + + +class WebsiteSale(website_sale): + def checkout_form_validate(self, data): + res = super(WebsiteSale, self).checkout_form_validate(data) + if not data.get('vat'): + res['vat'] = 'missing' + return res diff --git a/website_sale_vat_required/static/description/icon.png b/website_sale_vat_required/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0c66fd691908476fd5d494eaa9218677edda4282 GIT binary patch literal 1950 zcmV;P2VwY$P)vV2N{>Y+a?ETSGH zkbDSC1M9&udWd>4BZ+>9`{hdyk)af5k$So0Pp0=eJ#?z$@ywhvv-h6ad-nR^aN#n0 z&zkjpYwfjX@0kG<3WY+UP$(49A?fu`5xD?hc22w3Nj|RbYnT8;BrVy`1(I{sodFBL zfc$QJLvoe6HXs3r$P9p%<-U)RT&ynk8?COtHgThfq$09J-R!XdMC7pJa~u_sbLwh; zGr+P6&NFPW#!xsI0xE%uAaVhy2>cYlff_`hHGyZ-z&fIGA<0Rlz>gu|R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PS(he zG>gaxfHm#kY5?;*Huon0yGeeaa~*|3p-?CkS_Bp^{FVc_9l#`jeXi%v7VI4Ya1Ve{ z00&7PRsj@u;vgjNC%M)WdnW+&eM5AWACXELOnf)CkbJo&dv^hNuwb)GBxk7r?2une zbcJAVlxqQ1i68`fTd|Sf?(1w|_NGw_z<~os+ItOL*?YZ%K2JxT0UW^PMw8zh^f?-( z07BaXVB@PEIekxQ2JqaWaPU=+4qUAQ@Z6!Hq2+mmE{7ss0pOo|`-;nhVmu}ROe*DW zed451mOFUuGRqIW2=KcKT`qN#eRnw<^>0R-tEvAFGVK+hnqQq8(v60 zAL|gX#ep+h4vBKH&~!(%HGqSiJc}wY+vcNd=ShAMbrEPWs`ijPS%JM10KT)-*RU%) zL);Q(^7fELRgm9h?+TRv$i*)tZ*pm0sGCBIzBnRvIpz;&b6PO!_37XN9Xo~WRlTh) krh10!bpQYW07*qoM6N<$g2ju94FCWD literal 0 HcmV?d00001 diff --git a/website_sale_vat_required/website_order_view.xml b/website_sale_vat_required/website_order_view.xml new file mode 100644 index 0000000000..9058bafd6f --- /dev/null +++ b/website_sale_vat_required/website_order_view.xml @@ -0,0 +1,10 @@ + + + + + + From 082c5ab691d4c4bba5453f0474b713ac1f4ecb91 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 27 Oct 2015 23:15:47 +0100 Subject: [PATCH 2/5] [FIX] Vat label selector [FIX] Depend on vat validation module that causes the VAT number field to be displayed at checkout in the first place --- website_sale_vat_required/__openerp__.py | 1 + website_sale_vat_required/website_order_view.xml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/website_sale_vat_required/__openerp__.py b/website_sale_vat_required/__openerp__.py index 8cdf2a67d7..59d158e83d 100644 --- a/website_sale_vat_required/__openerp__.py +++ b/website_sale_vat_required/__openerp__.py @@ -28,6 +28,7 @@ 'license': 'AGPL-3', 'depends': [ 'website_sale', + 'base_vat', ], 'data': [ 'website_order_view.xml', diff --git a/website_sale_vat_required/website_order_view.xml b/website_sale_vat_required/website_order_view.xml index 9058bafd6f..770138a750 100644 --- a/website_sale_vat_required/website_order_view.xml +++ b/website_sale_vat_required/website_order_view.xml @@ -1,10 +1,10 @@ -