diff --git a/crm_lead_vat/README.rst b/crm_lead_vat/README.rst new file mode 100644 index 00000000000..e50dee8ec3a --- /dev/null +++ b/crm_lead_vat/README.rst @@ -0,0 +1,89 @@ +============ +VAT in leads +============ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github + :target: https://github.com/OCA/crm/tree/15.0/crm_lead_vat + :alt: OCA/crm +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/crm-15-0/crm-15-0-crm_lead_vat + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/crm&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to extend the functionality of CRM leads to support +setting the VAT identification number (https://en.wikipedia.org/wiki/VAT_identification_number). + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +* Go to *CRM > Leads*. +* Open a lead. +* You will see the new field. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Antiun Ingeniería S.L. + +Contributors +~~~~~~~~~~~~ + +* Rafael Blasco +* Jairo Llopis +* Tharathip Chaweewongphan + +* `Tecnativa `_: + + * Stefan Ungureanu + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/crm `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/crm_lead_vat/__init__.py b/crm_lead_vat/__init__.py new file mode 100644 index 00000000000..4b76c7b2d5c --- /dev/null +++ b/crm_lead_vat/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/crm_lead_vat/__manifest__.py b/crm_lead_vat/__manifest__.py new file mode 100644 index 00000000000..b19ffaceff0 --- /dev/null +++ b/crm_lead_vat/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "VAT in leads", + "summary": "Add VAT field to leads", + "version": "15.0.1.0.0", + "category": "Customer Relationship Management", + "website": "https://github.com/OCA/crm", + "author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": ["crm"], + "data": ["views/crm_lead_views.xml"], +} diff --git a/crm_lead_vat/i18n/bg.po b/crm_lead_vat/i18n/bg.po new file mode 100644 index 00000000000..1f13c773bc2 --- /dev/null +++ b/crm_lead_vat/i18n/bg.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-02 14:15+0000\n" +"PO-Revision-Date: 2016-03-10 18:53+0000\n" +"Last-Translator: <>\n" +"Language-Team: Bulgarian (http://www.transifex.com/oca/OCA-crm-8-0/language/" +"bg/)\n" +"Language: bg\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__display_name +msgid "Display Name" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__id +msgid "ID" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead____last_update +msgid "Last Modified on" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Следа/Възможност" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" diff --git a/crm_lead_vat/i18n/crm_lead_vat.pot b/crm_lead_vat/i18n/crm_lead_vat.pot new file mode 100644 index 00000000000..fdfff90f2a3 --- /dev/null +++ b/crm_lead_vat/i18n/crm_lead_vat.pot @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__display_name +msgid "Display Name" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__id +msgid "ID" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead____last_update +msgid "Last Modified on" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "" +"Tax Identification Number. The first 2 characters are the country code." +msgstr "" diff --git a/crm_lead_vat/i18n/de.po b/crm_lead_vat/i18n/de.po new file mode 100644 index 00000000000..50ffff100e9 --- /dev/null +++ b/crm_lead_vat/i18n/de.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-28 02:26+0000\n" +"PO-Revision-Date: 2017-04-11 14:58+0000\n" +"Last-Translator: Rudolf Schnapka \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-crm-8-0/language/" +"de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Lead/Chance" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "USt-ID:" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" +"Steueridentifikationsnummer. Die ersten zwei Zeichen stellen den " +"Länderschlüssel dar." diff --git a/crm_lead_vat/i18n/es.po b/crm_lead_vat/i18n/es.po new file mode 100644 index 00000000000..3bbf6efc552 --- /dev/null +++ b/crm_lead_vat/i18n/es.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +# Carles Antoli , 2016 +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-14 03:55+0000\n" +"PO-Revision-Date: 2016-04-07 15:49+0000\n" +"Last-Translator: Carles Antoli \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-crm-8-0/language/" +"es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciativa / Oportunidad" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "NIF" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" +"Número de identificación fiscal. Los 2 primeros caracteres son el código del " +"país." diff --git a/crm_lead_vat/i18n/fr.po b/crm_lead_vat/i18n/fr.po new file mode 100644 index 00000000000..21617a0157d --- /dev/null +++ b/crm_lead_vat/i18n/fr.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-03-10 18:52+0000\n" +"PO-Revision-Date: 2022-09-15 22:07+0000\n" +"Last-Translator: Claude R Perrin \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-crm-8-0/language/fr/)" +"\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Piste/Opportunité" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "Num TVA" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" +"Numéro d'identification fiscale ou de TVA. Les 2 premiers caractères sont le " +"code du pays." diff --git a/crm_lead_vat/i18n/hr.po b/crm_lead_vat/i18n/hr.po new file mode 100644 index 00000000000..87d0854e7a0 --- /dev/null +++ b/crm_lead_vat/i18n/hr.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +# Ana-Maria Olujić , 2016 +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-15 00:49+0000\n" +"PO-Revision-Date: 2016-08-19 13:47+0000\n" +"Last-Translator: Ana-Maria Olujić \n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-crm-8-0/language/" +"hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Potencijalni klijent" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "OIB" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "OIB. Prva 2 slova su oznaka države." diff --git a/crm_lead_vat/i18n/it.po b/crm_lead_vat/i18n/it.po new file mode 100644 index 00000000000..5b2f8f337db --- /dev/null +++ b/crm_lead_vat/i18n/it.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-16 11:11+0000\n" +"PO-Revision-Date: 2020-01-08 19:13+0000\n" +"Last-Translator: Sergio Zanchetta \n" +"Language-Team: Italian (http://www.transifex.com/oca/OCA-crm-8-0/language/it/" +")\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Contatto/Opportunità" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "P. IVA" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "Partita IVA. I primi 2 caratteri sono il codice nazione." diff --git a/crm_lead_vat/i18n/pt_BR.po b/crm_lead_vat/i18n/pt_BR.po new file mode 100644 index 00000000000..40a9785f170 --- /dev/null +++ b/crm_lead_vat/i18n/pt_BR.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-03-26 09:38+0000\n" +"PO-Revision-Date: 2019-09-03 03:23+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-crm-8-0/" +"language/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.8\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Prospector/Oportunidade" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "TIN" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" +"Número de identificação fiscal. Os 2 primeiros caracteres são o código do " +"país." diff --git a/crm_lead_vat/i18n/sk.po b/crm_lead_vat/i18n/sk.po new file mode 100644 index 00000000000..8038c136288 --- /dev/null +++ b/crm_lead_vat/i18n/sk.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-17 01:26+0000\n" +"PO-Revision-Date: 2016-03-10 18:53+0000\n" +"Last-Translator: <>\n" +"Language-Team: Slovak (http://www.transifex.com/oca/OCA-crm-8-0/language/" +"sk/)\n" +"Language: sk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciatíva/Príležitosť" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" diff --git a/crm_lead_vat/i18n/sl.po b/crm_lead_vat/i18n/sl.po new file mode 100644 index 00000000000..ec059d2b3f8 --- /dev/null +++ b/crm_lead_vat/i18n/sl.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-03-10 18:52+0000\n" +"PO-Revision-Date: 2016-03-11 10:47+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-crm-8-0/language/" +"sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Indic/priložnost" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "ID za DDV" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "Davčna identifikacijska številka. Prva 2 znaka sta črki kode države." diff --git a/crm_lead_vat/i18n/zh_CN.po b/crm_lead_vat/i18n/zh_CN.po new file mode 100644 index 00000000000..2412334bb40 --- /dev/null +++ b/crm_lead_vat/i18n/zh_CN.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_vat +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: crm (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-25 01:51+0000\n" +"PO-Revision-Date: 2016-03-10 18:53+0000\n" +"Last-Translator: <>\n" +"Language-Team: Chinese (China) (http://www.transifex.com/oca/OCA-crm-8-0/" +"language/zh_CN/)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: crm_lead_vat +#: model:ir.model,name:crm_lead_vat.model_crm_lead +msgid "Lead/Opportunity" +msgstr "线索/商机" + +#. module: crm_lead_vat +#: model:ir.model.fields,field_description:crm_lead_vat.field_crm_lead__vat +msgid "TIN" +msgstr "" + +#. module: crm_lead_vat +#: model:ir.model.fields,help:crm_lead_vat.field_crm_lead__vat +msgid "Tax Identification Number. The first 2 characters are the country code." +msgstr "" diff --git a/crm_lead_vat/models/__init__.py b/crm_lead_vat/models/__init__.py new file mode 100644 index 00000000000..f11a18fc4e9 --- /dev/null +++ b/crm_lead_vat/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import crm_lead diff --git a/crm_lead_vat/models/crm_lead.py b/crm_lead_vat/models/crm_lead.py new file mode 100644 index 00000000000..d117a688622 --- /dev/null +++ b/crm_lead_vat/models/crm_lead.py @@ -0,0 +1,27 @@ +# Copyright 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class Lead(models.Model): + _inherit = "crm.lead" + + vat = fields.Char( + string="TIN", + help="Tax Identification Number. The first 2 characters are the " + "country code.", + ) + + def _create_customer(self): + """Add VAT to partner.""" + return super(Lead, self.with_context(default_vat=self.vat))._create_customer() + + def _prepare_values_from_partner(self, partner): + """Recover VAT from partner if available.""" + result = super(Lead, self)._prepare_values_from_partner(partner) + if not partner: + return result + if partner.vat: + result["vat"] = partner.vat + return result diff --git a/crm_lead_vat/readme/CONTRIBUTORS.rst b/crm_lead_vat/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..2f3bb28bc81 --- /dev/null +++ b/crm_lead_vat/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Rafael Blasco +* Jairo Llopis +* Tharathip Chaweewongphan + +* `Tecnativa `_: + + * Stefan Ungureanu diff --git a/crm_lead_vat/readme/DESCRIPTION.rst b/crm_lead_vat/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..ac79a5e9bc0 --- /dev/null +++ b/crm_lead_vat/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module was written to extend the functionality of CRM leads to support +setting the VAT identification number (https://en.wikipedia.org/wiki/VAT_identification_number). diff --git a/crm_lead_vat/readme/USAGE.rst b/crm_lead_vat/readme/USAGE.rst new file mode 100644 index 00000000000..ad131e83519 --- /dev/null +++ b/crm_lead_vat/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +* Go to *CRM > Leads*. +* Open a lead. +* You will see the new field. diff --git a/crm_lead_vat/static/description/icon.png b/crm_lead_vat/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/crm_lead_vat/static/description/icon.png differ diff --git a/crm_lead_vat/static/description/index.html b/crm_lead_vat/static/description/index.html new file mode 100644 index 00000000000..7478030e835 --- /dev/null +++ b/crm_lead_vat/static/description/index.html @@ -0,0 +1,436 @@ + + + + + + +VAT in leads + + + +
+

VAT in leads

+ + +

Beta License: AGPL-3 OCA/crm Translate me on Weblate Try me on Runboat

+

This module was written to extend the functionality of CRM leads to support +setting the VAT identification number (https://en.wikipedia.org/wiki/VAT_identification_number).

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • Go to CRM > Leads.
  • +
  • Open a lead.
  • +
  • You will see the new field.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Antiun Ingeniería S.L.
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/crm project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/crm_lead_vat/tests/__init__.py b/crm_lead_vat/tests/__init__.py new file mode 100644 index 00000000000..c6e811f5206 --- /dev/null +++ b/crm_lead_vat/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import test_lead diff --git a/crm_lead_vat/tests/test_lead.py b/crm_lead_vat/tests/test_lead.py new file mode 100644 index 00000000000..2b0a3d04b5b --- /dev/null +++ b/crm_lead_vat/tests/test_lead.py @@ -0,0 +1,29 @@ +# Copyright 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class LeadCase(TransactionCase): + def setUp(self): + super(LeadCase, self).setUp() + self.lead = self.env["crm.lead"].create( + {"name": __file__, "partner_name": "HÎ"} + ) + self.partner = self.env["res.partner"].create({"name": __file__}) + self.test_field = "ES98765432M" + + def test_transfered_values(self): + """Field gets transfered when creating partner.""" + self.lead.vat = self.test_field + self.lead._handle_partner_assignment() + self.assertEqual(self.lead.partner_id.vat, self.test_field) + + def test_onchange_partner_id(self): + """Lead gets VAT from partner when linked to it.""" + self.partner.vat = self.test_field + result = self.lead._prepare_values_from_partner(self.lead.partner_id) + self.assertNotIn("vat", result) + self.lead.partner_id = self.partner + result = self.lead._prepare_values_from_partner(self.lead.partner_id) + self.assertEqual(result["vat"], self.test_field) diff --git a/crm_lead_vat/views/crm_lead_views.xml b/crm_lead_vat/views/crm_lead_views.xml new file mode 100644 index 00000000000..43b5a9f83a7 --- /dev/null +++ b/crm_lead_vat/views/crm_lead_views.xml @@ -0,0 +1,15 @@ + + + + crm.lead + + + + + + + + + + + diff --git a/setup/crm_lead_vat/odoo/addons/crm_lead_vat b/setup/crm_lead_vat/odoo/addons/crm_lead_vat new file mode 120000 index 00000000000..f05754a7d7c --- /dev/null +++ b/setup/crm_lead_vat/odoo/addons/crm_lead_vat @@ -0,0 +1 @@ +../../../../crm_lead_vat \ No newline at end of file diff --git a/setup/crm_lead_vat/setup.py b/setup/crm_lead_vat/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/crm_lead_vat/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)