diff --git a/crm_lead_code/README.rst b/crm_lead_code/README.rst new file mode 100644 index 00000000000..eb4539e84a0 --- /dev/null +++ b/crm_lead_code/README.rst @@ -0,0 +1,88 @@ +========================================= +Sequential Code for Leads / Opportunities +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:463dc21da7004517ade8f6bb62dc50bb9477208671976eaf4a017179b6ad038d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/crm_lead_code + :alt: OCA/crm +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_lead_code + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a sequential code for leads / opportunities. + +**Table of contents** + +.. contents:: + :local: + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa +* AvanzOSC + +Contributors +------------ + +- Oihane Crucelaegui +- Pedro M. Baeza +- Ana Juaristi +- Nicol??s Ramos +- Mathias Markl +- Serpent Consulting Services Pvt. Ltd. +- Tharathip Chaweewongphan +- `APSL `__: + + - Antoni Marroig + +- ``Heliconia Solutions Pvt. Ltd. ``\ \_ + +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_code/__init__.py b/crm_lead_code/__init__.py new file mode 100644 index 00000000000..bee186a9ea4 --- /dev/null +++ b/crm_lead_code/__init__.py @@ -0,0 +1,25 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################## + +from . import models +from odoo import api, SUPERUSER_ID + + +def create_code_equal_to_id(env): + env.cr.execute("ALTER TABLE crm_lead ADD COLUMN code character varying;") + env.cr.execute("UPDATE crm_lead SET code = id;") + + +def assign_old_sequences(env): + lead_obj = env["crm.lead"] + sequence_obj = env["ir.sequence"] + leads = lead_obj.search([], order="id") + for lead_id in leads.ids: + env.cr.execute( + "UPDATE crm_lead SET code = %s WHERE id = %s;", + ( + sequence_obj.next_by_code("crm.lead"), + lead_id, + ), + ) diff --git a/crm_lead_code/__manifest__.py b/crm_lead_code/__manifest__.py new file mode 100644 index 00000000000..bb0944fb7f2 --- /dev/null +++ b/crm_lead_code/__manifest__.py @@ -0,0 +1,34 @@ +############################################################################## +# +# Copyright (c) +# 2015 Serv. Tec. Avanzados - Pedro M. Baeza (http://www.serviciosbaeza.com) +# 2015 AvanzOsc (http://www.avanzosc.es) +# +# 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": "Sequential Code for Leads / Opportunities", + "version": "18.0.1.0.0", + "category": "Customer Relationship Management", + "author": "Tecnativa, AvanzOSC, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/crm", + "license": "AGPL-3", + "depends": ["crm"], + "data": ["data/lead_sequence.xml", "views/crm_lead_view.xml"], + "installable": True, + "pre_init_hook": "create_code_equal_to_id", + "post_init_hook": "assign_old_sequences", +} diff --git a/crm_lead_code/data/lead_sequence.xml b/crm_lead_code/data/lead_sequence.xml new file mode 100644 index 00000000000..b07eac6c1bf --- /dev/null +++ b/crm_lead_code/data/lead_sequence.xml @@ -0,0 +1,8 @@ + + + Lead Code + crm.lead + + LD + + diff --git a/crm_lead_code/i18n/bg.po b/crm_lead_code/i18n/bg.po new file mode 100644 index 00000000000..5fe73a40643 --- /dev/null +++ b/crm_lead_code/i18n/bg.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2017-12-04 15:47+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Bulgarian (https://www.transifex.com/oca/teams/23907/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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "??????????/????????????????????" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/i18n/ca.po b/crm_lead_code/i18n/ca.po new file mode 100644 index 00000000000..232c7c98de6 --- /dev/null +++ b/crm_lead_code/i18n/ca.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-04-13 11:05+0000\n" +"Last-Translator: Noel estudillo \n" +"Language-Team: none\n" +"Language: ca\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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Número de plom" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Plom/Oportunitat" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "El codi ha de ser únic!" diff --git a/crm_lead_code/i18n/crm_lead_code.pot b/crm_lead_code/i18n/crm_lead_code.pot new file mode 100644 index 00000000000..259a2cca66a --- /dev/null +++ b/crm_lead_code/i18n/crm_lead_code.pot @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/i18n/de.po b/crm_lead_code/i18n/de.po new file mode 100644 index 00000000000..1542e170089 --- /dev/null +++ b/crm_lead_code/i18n/de.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2018-12-13 12:58+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/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" +"X-Generator: Weblate 3.3\n" + +#. module: crm_lead_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Lead-Nummer" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Lead/Chance" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "Der Schl??ssel muss eindeutig sein!" diff --git a/crm_lead_code/i18n/es.po b/crm_lead_code/i18n/es.po new file mode 100644 index 00000000000..92e79dcd931 --- /dev/null +++ b/crm_lead_code/i18n/es.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2023-08-02 14:10+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/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" +"X-Generator: Weblate 4.17\n" + +#. module: crm_lead_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Número de oportunidad" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciativa/Oportunidad" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "El código debe ser único!" + +#~ msgid "&nbsp;" +#~ msgstr "&nbsp;" diff --git a/crm_lead_code/i18n/es_AR.po b/crm_lead_code/i18n/es_AR.po new file mode 100644 index 00000000000..83787dc7885 --- /dev/null +++ b/crm_lead_code/i18n/es_AR.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-10-29 23:38+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\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.17\n" + +#. module: crm_lead_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Número de Iniciativa" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciativa/Oportunidad" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "¡El código debe ser único!" + +#~ msgid "&nbsp;" +#~ msgstr "&nbsp;" + +#~ msgid "Display Name" +#~ msgstr "Mostrar Nombre" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación el" diff --git a/crm_lead_code/i18n/fr.po b/crm_lead_code/i18n/fr.po new file mode 100644 index 00000000000..7f0bc9422c8 --- /dev/null +++ b/crm_lead_code/i18n/fr.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2022-03-02 17:17+0000\n" +"Last-Translator: ajaniszewska-dev \n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Numéro de Lead" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Piste/Opportunité" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "Le code doit être unique !" diff --git a/crm_lead_code/i18n/hr.po b/crm_lead_code/i18n/hr.po new file mode 100644 index 00000000000..3725ab06013 --- /dev/null +++ b/crm_lead_code/i18n/hr.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2017-12-04 15:47+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Potencijalni klijent" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/i18n/it.po b/crm_lead_code/i18n/it.po new file mode 100644 index 00000000000..65af238cbba --- /dev/null +++ b/crm_lead_code/i18n/it.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2023-06-12 16:10+0000\n" +"Last-Translator: mymage \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/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 4.17\n" + +#. module: crm_lead_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Numero contatto" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Contatto/Opportunità" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "Il codice deve essere univoco!" + +#~ msgid "&nbsp;" +#~ msgstr "&nbsp;" diff --git a/crm_lead_code/i18n/pt_BR.po b/crm_lead_code/i18n/pt_BR.po new file mode 100644 index 00000000000..10cf671a5d2 --- /dev/null +++ b/crm_lead_code/i18n/pt_BR.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2024-07-06 20:58+0000\n" +"Last-Translator: Rodrigo Sottomaior Macedo " +"\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/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 5.6.2\n" + +#. module: crm_lead_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "Número da ligação" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Prospector/Oportunidade" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "O código deve ser único!" + +#~ msgid "&nbsp;" +#~ msgstr "&nbsp;" diff --git a/crm_lead_code/i18n/sk.po b/crm_lead_code/i18n/sk.po new file mode 100644 index 00000000000..b78a23afa00 --- /dev/null +++ b/crm_lead_code/i18n/sk.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2017-12-04 15:47+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovak (https://www.transifex.com/oca/teams/23907/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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciat??va/Pr??le??itos??" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/i18n/sl.po b/crm_lead_code/i18n/sl.po new file mode 100644 index 00000000000..6c01f7857fe --- /dev/null +++ b/crm_lead_code/i18n/sl.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2023-04-11 13:27+0000\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/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" +"X-Generator: Weblate 4.14.1\n" + +#. module: crm_lead_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Indic/priložnost" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/i18n/tr.po b/crm_lead_code/i18n/tr.po new file mode 100644 index 00000000000..44938403656 --- /dev/null +++ b/crm_lead_code/i18n/tr.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# Ediz Duman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2017-12-04 15:47+0000\n" +"Last-Translator: Ediz Duman , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Aday/F??rsat" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/i18n/zh_CN.po b/crm_lead_code/i18n/zh_CN.po new file mode 100644 index 00000000000..abb525f5080 --- /dev/null +++ b/crm_lead_code/i18n/zh_CN.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_code +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-04 15:47+0000\n" +"PO-Revision-Date: 2017-12-04 15:47+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/" +"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_code +#: model:ir.model.fields,field_description:crm_lead_code.field_crm_lead__code +msgid "Lead Number" +msgstr "" + +#. module: crm_lead_code +#: model:ir.model,name:crm_lead_code.model_crm_lead +msgid "Lead/Opportunity" +msgstr "??????/??????" + +#. module: crm_lead_code +#. odoo-python +#: code:addons/crm_lead_code/models/crm_lead.py:0 +#: model:ir.model.constraint,message:crm_lead_code.constraint_crm_lead_crm_lead_unique_code +#, python-format +msgid "The code must be unique!" +msgstr "" diff --git a/crm_lead_code/models/__init__.py b/crm_lead_code/models/__init__.py new file mode 100644 index 00000000000..ed991450bfe --- /dev/null +++ b/crm_lead_code/models/__init__.py @@ -0,0 +1,4 @@ +############################################################################# +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################## +from . import crm_lead diff --git a/crm_lead_code/models/crm_lead.py b/crm_lead_code/models/crm_lead.py new file mode 100644 index 00000000000..631741326bb --- /dev/null +++ b/crm_lead_code/models/crm_lead.py @@ -0,0 +1,26 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################## + +from odoo import _, api, fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + code = fields.Char( + string="Lead Number", required=True, default="/", readonly=True, copy=False + ) + + _sql_constraints = [ + ("crm_lead_unique_code", "UNIQUE (code)", _("The code must be unique!")), + ] + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + if vals.get("code", "/") == "/": + vals["code"] = self.env.ref( + "crm_lead_code.sequence_lead", raise_if_not_found=False + ).next_by_id() + return super().create(vals_list) diff --git a/crm_lead_code/pyproject.toml b/crm_lead_code/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/crm_lead_code/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/crm_lead_code/readme/CONTRIBUTORS.md b/crm_lead_code/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..65b38618283 --- /dev/null +++ b/crm_lead_code/readme/CONTRIBUTORS.md @@ -0,0 +1,10 @@ +- Oihane Crucelaegui \<\> +- Pedro M. Baeza \<\> +- Ana Juaristi \<\> +- Nicol??s Ramos \<\> +- Mathias Markl \<\> +- Serpent Consulting Services Pvt. Ltd. \<\> +- Tharathip Chaweewongphan \<\> +- [APSL](https://apsl.tech): + - Antoni Marroig +- `Heliconia Solutions Pvt. Ltd. `_ diff --git a/crm_lead_code/readme/DESCRIPTION.md b/crm_lead_code/readme/DESCRIPTION.md new file mode 100644 index 00000000000..739a2ce6208 --- /dev/null +++ b/crm_lead_code/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds a sequential code for leads / opportunities. diff --git a/crm_lead_code/static/description/icon.png b/crm_lead_code/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/crm_lead_code/static/description/icon.png differ diff --git a/crm_lead_code/static/description/index.html b/crm_lead_code/static/description/index.html new file mode 100644 index 00000000000..843b956c969 --- /dev/null +++ b/crm_lead_code/static/description/index.html @@ -0,0 +1,435 @@ + + + + + +Sequential Code for Leads / Opportunities + + + +
+

Sequential Code for Leads / Opportunities

+ + +

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

+

This module adds a sequential code for leads / opportunities.

+

Table of contents

+ +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
  • AvanzOSC
  • +
+
+
+

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_code/tests/__init__.py b/crm_lead_code/tests/__init__.py new file mode 100644 index 00000000000..4982e98fb01 --- /dev/null +++ b/crm_lead_code/tests/__init__.py @@ -0,0 +1,5 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################## + +from . import test_crm_lead_code diff --git a/crm_lead_code/tests/test_crm_lead_code.py b/crm_lead_code/tests/test_crm_lead_code.py new file mode 100644 index 00000000000..0fbbc0bdfe1 --- /dev/null +++ b/crm_lead_code/tests/test_crm_lead_code.py @@ -0,0 +1,35 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################## + +from odoo.tests.common import TransactionCase + + +class TestCrmLeadCode(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.crm_lead_model = cls.env["crm.lead"] + cls.ir_sequence_model = cls.env["ir.sequence"] + cls.crm_sequence = cls.env.ref("crm_lead_code.sequence_lead") + cls.crm_lead = cls.env.ref("crm.crm_case_1") + + def test_old_lead_code_assign(self): + crm_leads = self.crm_lead_model.search([]) + for crm_lead in crm_leads: + self.assertNotEqual(crm_lead.code, "/") + + def test_new_lead_code_assign(self): + code = self._get_next_code() + crm_lead = self.crm_lead_model.create({"name": "Testing lead code"}) + self.assertNotEqual(crm_lead.code, "/") + self.assertEqual(crm_lead.code, code) + + def test_copy_lead_code_assign(self): + code = self._get_next_code() + crm_lead_copy = self.crm_lead.copy() + self.assertNotEqual(crm_lead_copy.code, self.crm_lead.code) + self.assertEqual(crm_lead_copy.code, code) + + def _get_next_code(self): + return self.crm_sequence.get_next_char(self.crm_sequence.number_next_actual) diff --git a/crm_lead_code/views/crm_lead_view.xml b/crm_lead_code/views/crm_lead_view.xml new file mode 100644 index 00000000000..6111b91a89e --- /dev/null +++ b/crm_lead_code/views/crm_lead_view.xml @@ -0,0 +1,68 @@ + + + crm.lead.form + crm.lead + + + + + + + + + crm.lead.tree.lead + crm.lead + + + + + + + + + crm.lead.search.lead + crm.lead + + + + ['|', ('name', 'ilike', self), ('code', 'ilike', self)] + + + + + crm.lead.tree.opportunity + crm.lead + + + + + + + + + crm.lead.kanban.lead + crm.lead + + + + + + + + + + crm.lead.search.opportunity + crm.lead + + + + ['|', ('name', 'ilike', self), ('code', 'ilike', self)] + + + +