diff --git a/partner_stage/README.rst b/partner_stage/README.rst new file mode 100644 index 00000000000..ddc528e3616 --- /dev/null +++ b/partner_stage/README.rst @@ -0,0 +1,100 @@ +============= +Partner Stage +============= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:39e14ed799110c493e3451c0f9aac4b2feef7cd17fcb72e1e188684bb9443380 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/18.0/partner_stage + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-18-0/partner-contact-18-0-partner_stage + :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/partner-contact&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds stages to Contacts allowing, for example, to setup a lifecycle +workflow. The default stages are: Draft, Active and Inactive. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Open a Contact form to see the corresponding Stage. It is visible in the +stages bar, at the top right are of the form. + +The contact stage can be changed clicking on the stages bar. + +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 +------- + +* Open Source Integrators + +Contributors +------------ + +- Daniel Reis +- Urvisha Desai + +- ``Camptocamp ``\ \_\_: + + - Maksym Yankin maksym.yankin@camptocamp.com + +- Bert Van Groenendael + +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. + +.. |maintainer-dreispt| image:: https://github.com/dreispt.png?size=40px + :target: https://github.com/dreispt + :alt: dreispt + +Current `maintainer `__: + +|maintainer-dreispt| + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_stage/__init__.py b/partner_stage/__init__.py new file mode 100644 index 00000000000..d71877a496b --- /dev/null +++ b/partner_stage/__init__.py @@ -0,0 +1,2 @@ +from . import models +from .init_hook import post_init_hook diff --git a/partner_stage/__manifest__.py b/partner_stage/__manifest__.py new file mode 100644 index 00000000000..0e82516add8 --- /dev/null +++ b/partner_stage/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2021 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +{ + "name": "Partner Stage", + "summary": "Add lifecycle Stages to Partners", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/partner-contact", + "category": "Sales/CRM", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "depends": ["contacts"], + "data": [ + "security/ir.model.access.csv", + "data/partner_stage_data.xml", + "views/res_partner_stage_views.xml", + "views/res_partner_views.xml", + ], + "post_init_hook": "post_init_hook", + "installable": True, + "maintainers": ["dreispt"], +} diff --git a/partner_stage/data/partner_stage_data.xml b/partner_stage/data/partner_stage_data.xml new file mode 100644 index 00000000000..c483483f4b5 --- /dev/null +++ b/partner_stage/data/partner_stage_data.xml @@ -0,0 +1,20 @@ + + + + Draft + draft + 10 + + + Active + confirmed + 20 + True + + + Inactive + cancel + 30 + True + + diff --git a/partner_stage/i18n/es.po b/partner_stage/i18n/es.po new file mode 100644 index 00000000000..233add07fcf --- /dev/null +++ b/partner_stage/i18n/es.po @@ -0,0 +1,159 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_stage +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-08-31 08:13+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\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: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__active +#: model:res.partner.stage,name:partner_stage.partner_stage_active +msgid "Active" +msgstr "Activo" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__confirmed +msgid "Approved" +msgstr "Aprobado" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__cancel +msgid "Archived" +msgstr "Archivado" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__code +msgid "Code" +msgstr "Código" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner_stage +msgid "Contact Stage" +msgstr "Etapa de contacto" + +#. module: partner_stage +#: model:ir.ui.menu,name:partner_stage.menu_partner_stage +msgid "Contact Stages" +msgstr "Etapas de contacto" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__is_default +msgid "Default state" +msgstr "Estado por defecto" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__description +msgid "Description" +msgstr "Descripción" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_draft +msgid "Draft" +msgstr "Borrador" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__fold +msgid "Fold" +msgstr "Pliegue" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__id +msgid "ID" +msgstr "ID (identificación)" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_inactive +msgid "Inactive" +msgstr "Inactivo" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_date +msgid "Last Updated on" +msgstr "Última Actualización el" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__name +msgid "Name" +msgstr "Nombre" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__state +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__state +msgid "Related State" +msgstr "Estado relacionado" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: partner_stage +#: model:ir.actions.act_window,name:partner_stage.action_partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__stage_id +#: model:ir.model.fields,field_description:partner_stage.field_res_users__stage_id +#: model_terms:ir.ui.view,arch_db:partner_stage.view_partner_search +msgid "Stage" +msgstr "Etapa" + +#. module: partner_stage +#: model:ir.model.constraint,message:partner_stage.constraint_res_partner_stage_res_partner_stage_code_unique +msgid "Stage Code must be unique." +msgstr "El código de etapa debe ser único." + +#. module: partner_stage +#. odoo-python +#: code:addons/partner_stage/models/res_partner_stage.py:0 +#, python-format +msgid "There should be only one default stage" +msgstr "Sólo debería haber una etapa predeterminada" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__draft +msgid "To Approve" +msgstr "Para Aprobar" + +#. module: partner_stage +#: model:ir.model.fields,help:partner_stage.field_res_partner_stage__sequence +msgid "Used to order the stages" +msgstr "Se utiliza para ordenar las etapas" diff --git a/partner_stage/i18n/it.po b/partner_stage/i18n/it.po new file mode 100644 index 00000000000..12e3756c3be --- /dev/null +++ b/partner_stage/i18n/it.po @@ -0,0 +1,159 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_stage +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-12-27 08:35+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\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: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__active +#: model:res.partner.stage,name:partner_stage.partner_stage_active +msgid "Active" +msgstr "Attivo" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__confirmed +msgid "Approved" +msgstr "Approvato" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__cancel +msgid "Archived" +msgstr "In archivio" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__code +msgid "Code" +msgstr "Codice" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner +msgid "Contact" +msgstr "Contatto" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner_stage +msgid "Contact Stage" +msgstr "Fase contatto" + +#. module: partner_stage +#: model:ir.ui.menu,name:partner_stage.menu_partner_stage +msgid "Contact Stages" +msgstr "Fasi contatto" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__is_default +msgid "Default state" +msgstr "Stato predefinito" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__description +msgid "Description" +msgstr "Descrizione" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_draft +msgid "Draft" +msgstr "Bozza" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__fold +msgid "Fold" +msgstr "Chiuso" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__id +msgid "ID" +msgstr "ID" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_inactive +msgid "Inactive" +msgstr "Inattivo" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__name +msgid "Name" +msgstr "Nome" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__state +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__state +msgid "Related State" +msgstr "Stato correlato" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__sequence +msgid "Sequence" +msgstr "Sequenza" + +#. module: partner_stage +#: model:ir.actions.act_window,name:partner_stage.action_partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__stage_id +#: model:ir.model.fields,field_description:partner_stage.field_res_users__stage_id +#: model_terms:ir.ui.view,arch_db:partner_stage.view_partner_search +msgid "Stage" +msgstr "Fase" + +#. module: partner_stage +#: model:ir.model.constraint,message:partner_stage.constraint_res_partner_stage_res_partner_stage_code_unique +msgid "Stage Code must be unique." +msgstr "Il codice della fase deve essere univoco." + +#. module: partner_stage +#. odoo-python +#: code:addons/partner_stage/models/res_partner_stage.py:0 +#, python-format +msgid "There should be only one default stage" +msgstr "Deve essere presente una sola fase predefinita" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__draft +msgid "To Approve" +msgstr "Da approvare" + +#. module: partner_stage +#: model:ir.model.fields,help:partner_stage.field_res_partner_stage__sequence +msgid "Used to order the stages" +msgstr "Utilizzato per ordinare le fasi" diff --git a/partner_stage/i18n/partner_stage.pot b/partner_stage/i18n/partner_stage.pot new file mode 100644 index 00000000000..becca4a0f41 --- /dev/null +++ b/partner_stage/i18n/partner_stage.pot @@ -0,0 +1,151 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_stage +# +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: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__active +#: model:res.partner.stage,name:partner_stage.partner_stage_active +msgid "Active" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__confirmed +msgid "Approved" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__cancel +msgid "Archived" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__code +msgid "Code" +msgstr "" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner +msgid "Contact" +msgstr "" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner_stage +msgid "Contact Stage" +msgstr "" + +#. module: partner_stage +#: model:ir.ui.menu,name:partner_stage.menu_partner_stage +msgid "Contact Stages" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_uid +msgid "Created by" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_date +msgid "Created on" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__is_default +msgid "Default state" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__description +msgid "Description" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__display_name +msgid "Display Name" +msgstr "" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_draft +msgid "Draft" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__fold +msgid "Fold" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__id +msgid "ID" +msgstr "" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_inactive +msgid "Inactive" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_date +msgid "Last Updated on" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__name +msgid "Name" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__state +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__state +msgid "Related State" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__sequence +msgid "Sequence" +msgstr "" + +#. module: partner_stage +#: model:ir.actions.act_window,name:partner_stage.action_partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__stage_id +#: model:ir.model.fields,field_description:partner_stage.field_res_users__stage_id +#: model_terms:ir.ui.view,arch_db:partner_stage.view_partner_search +msgid "Stage" +msgstr "" + +#. module: partner_stage +#: model:ir.model.constraint,message:partner_stage.constraint_res_partner_stage_res_partner_stage_code_unique +msgid "Stage Code must be unique." +msgstr "" + +#. module: partner_stage +#. odoo-python +#: code:addons/partner_stage/models/res_partner_stage.py:0 +#, python-format +msgid "There should be only one default stage" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__draft +msgid "To Approve" +msgstr "" + +#. module: partner_stage +#: model:ir.model.fields,help:partner_stage.field_res_partner_stage__sequence +msgid "Used to order the stages" +msgstr "" diff --git a/partner_stage/i18n/pt.po b/partner_stage/i18n/pt.po new file mode 100644 index 00000000000..a731ec1e19c --- /dev/null +++ b/partner_stage/i18n/pt.po @@ -0,0 +1,159 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_stage +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-08-20 20:07+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\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: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__active +#: model:res.partner.stage,name:partner_stage.partner_stage_active +msgid "Active" +msgstr "Ativo" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__confirmed +msgid "Approved" +msgstr "Aprovado" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__cancel +msgid "Archived" +msgstr "Arquivado" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__code +msgid "Code" +msgstr "Código" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: partner_stage +#: model:ir.model,name:partner_stage.model_res_partner_stage +msgid "Contact Stage" +msgstr "Estado do Contacto" + +#. module: partner_stage +#: model:ir.ui.menu,name:partner_stage.menu_partner_stage +msgid "Contact Stages" +msgstr "Estados dos Contactos" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_uid +msgid "Created by" +msgstr "Criado por" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__create_date +msgid "Created on" +msgstr "Criado em" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__is_default +msgid "Default state" +msgstr "Estado predefinido" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__description +msgid "Description" +msgstr "Descrição" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__display_name +msgid "Display Name" +msgstr "Nome a Exibir" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_draft +msgid "Draft" +msgstr "Rascunho" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__fold +msgid "Fold" +msgstr "Dobrar" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__id +msgid "ID" +msgstr "ID" + +#. module: partner_stage +#: model:res.partner.stage,name:partner_stage.partner_stage_inactive +msgid "Inactive" +msgstr "Inativo" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage____last_update +msgid "Last Modified on" +msgstr "Última Modificação Em" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_uid +msgid "Last Updated by" +msgstr "Atualizado pela última vez por" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__write_date +msgid "Last Updated on" +msgstr "Atualizado pela última vez em" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__name +msgid "Name" +msgstr "Nome" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__state +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__state +msgid "Related State" +msgstr "Estado Relacionado" + +#. module: partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner_stage__sequence +msgid "Sequence" +msgstr "Sequência" + +#. module: partner_stage +#: model:ir.actions.act_window,name:partner_stage.action_partner_stage +#: model:ir.model.fields,field_description:partner_stage.field_res_partner__stage_id +#: model:ir.model.fields,field_description:partner_stage.field_res_users__stage_id +#: model_terms:ir.ui.view,arch_db:partner_stage.view_partner_search +msgid "Stage" +msgstr "Estado" + +#. module: partner_stage +#: model:ir.model.constraint,message:partner_stage.constraint_res_partner_stage_res_partner_stage_code_unique +msgid "Stage Code must be unique." +msgstr "O Código do Estado tem que ser único." + +#. module: partner_stage +#. odoo-python +#: code:addons/partner_stage/models/res_partner_stage.py:0 +#, python-format +msgid "There should be only one default stage" +msgstr "Só devia haver um estado predefinido" + +#. module: partner_stage +#: model:ir.model.fields.selection,name:partner_stage.selection__res_partner_stage__state__draft +msgid "To Approve" +msgstr "A Aprovar" + +#. module: partner_stage +#: model:ir.model.fields,help:partner_stage.field_res_partner_stage__sequence +msgid "Used to order the stages" +msgstr "Utilizado para ordenar os estados" diff --git a/partner_stage/init_hook.py b/partner_stage/init_hook.py new file mode 100644 index 00000000000..413307303b8 --- /dev/null +++ b/partner_stage/init_hook.py @@ -0,0 +1,23 @@ +# Copyright 2021 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +import logging + +_logger = logging.getLogger(__name__) + + +def post_init_hook(env): + """Set default Stage on partners""" + Partner = env["res.partner"] + default_stage = Partner._get_default_stage_id() + missing_stages = Partner.search([("stage_id", "=", False)]) + if default_stage and missing_stages: + _logger.info("Init stage_id for %d partner records...", len(missing_stages)) + env.cr.execute( + """ + UPDATE res_partner + SET stage_id = %(id)s, state = %(state)s + WHERE stage_id IS NULL + """, + {"id": default_stage.id, "state": default_stage.state}, + ) diff --git a/partner_stage/models/__init__.py b/partner_stage/models/__init__.py new file mode 100644 index 00000000000..3f194dcab33 --- /dev/null +++ b/partner_stage/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_partner_stage +from . import res_partner diff --git a/partner_stage/models/res_partner.py b/partner_stage/models/res_partner.py new file mode 100644 index 00000000000..1b6da1e7569 --- /dev/null +++ b/partner_stage/models/res_partner.py @@ -0,0 +1,28 @@ +# Copyright 2021 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class Partner(models.Model): + _inherit = "res.partner" + + @api.model + def _get_default_stage_id(self): + return self.env["res.partner.stage"].search( + [("is_default", "=", True)], limit=1 + ) + + @api.model + def _read_group_stage_id(self, states, domain, order): + return states.search([]) + + stage_id = fields.Many2one( + comodel_name="res.partner.stage", + group_expand="_read_group_stage_id", + default=_get_default_stage_id, + copy=False, + index=True, + tracking=True, + ) + state = fields.Selection(related="stage_id.state", store=True, readonly=True) diff --git a/partner_stage/models/res_partner_stage.py b/partner_stage/models/res_partner_stage.py new file mode 100644 index 00000000000..9740fde3397 --- /dev/null +++ b/partner_stage/models/res_partner_stage.py @@ -0,0 +1,34 @@ +# Copyright 2021 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + + +class PartnerStage(models.Model): + _name = "res.partner.stage" + _description = "Contact Stage" + _order = "sequence, id" + + name = fields.Char(required=True, translate=True) + code = fields.Char() + sequence = fields.Integer(help="Used to order the stages", default=10) + fold = fields.Boolean() + active = fields.Boolean(default=True) + description = fields.Text(translate=True) + is_default = fields.Boolean("Default state") + + state = fields.Selection( + [("draft", "To Approve"), ("confirmed", "Approved"), ("cancel", "Archived")], + string="Related State", + default="confirmed", + ) + + _sql_constraints = [ + ("res_partner_stage_code_unique", "UNIQUE(code)", "Stage Code must be unique.") + ] + + @api.constrains("is_default") + def _check_default(self): + if self.search_count([("is_default", "=", True)]) > 1: + raise ValidationError(_("There should be only one default stage")) diff --git a/partner_stage/pyproject.toml b/partner_stage/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/partner_stage/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/partner_stage/readme/CONFIGURATION.rst b/partner_stage/readme/CONFIGURATION.rst new file mode 100644 index 00000000000..49ec1096db5 --- /dev/null +++ b/partner_stage/readme/CONFIGURATION.rst @@ -0,0 +1,7 @@ +To create a new Stage: + +#. Navigate to *Contacts > Configuration > Contact Stages*. + +#. Create a new record, and set the name, code and a description. + +#. The stage order can be modified using teh handle widget, on the list view. diff --git a/partner_stage/readme/CONTRIBUTORS.md b/partner_stage/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..053025a6784 --- /dev/null +++ b/partner_stage/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Daniel Reis \<\> +- Urvisha Desai \<\> +* `Camptocamp `__: + + * Maksym Yankin + +- Bert Van Groenendael \<\> diff --git a/partner_stage/readme/DESCRIPTION.md b/partner_stage/readme/DESCRIPTION.md new file mode 100644 index 00000000000..882a6f95443 --- /dev/null +++ b/partner_stage/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +Adds stages to Contacts allowing, for example, to setup a lifecycle +workflow. The default stages are: Draft, Active and Inactive. diff --git a/partner_stage/readme/USAGE.md b/partner_stage/readme/USAGE.md new file mode 100644 index 00000000000..46a372c2164 --- /dev/null +++ b/partner_stage/readme/USAGE.md @@ -0,0 +1,4 @@ +Open a Contact form to see the corresponding Stage. It is visible in the +stages bar, at the top right are of the form. + +The contact stage can be changed clicking on the stages bar. diff --git a/partner_stage/security/ir.model.access.csv b/partner_stage/security/ir.model.access.csv new file mode 100644 index 00000000000..8dde3cfefb4 --- /dev/null +++ b/partner_stage/security/ir.model.access.csv @@ -0,0 +1,3 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_partner_stage_edit","access_partner_stage_edit","model_res_partner_stage","base.group_system",1,1,1,1 +"access_partner_stage_read","access_partner_stage_read","model_res_partner_stage","base.group_user",1,0,0,0 diff --git a/partner_stage/static/description/icon.png b/partner_stage/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/partner_stage/static/description/icon.png differ diff --git a/partner_stage/static/description/index.html b/partner_stage/static/description/index.html new file mode 100644 index 00000000000..55186d9f92c --- /dev/null +++ b/partner_stage/static/description/index.html @@ -0,0 +1,439 @@ + + + + + +Partner Stage + + + +
+

Partner Stage

+ + +

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

+

Adds stages to Contacts allowing, for example, to setup a lifecycle +workflow. The default stages are: Draft, Active and Inactive.

+

Table of contents

+ +
+

Usage

+

Open a Contact form to see the corresponding Stage. It is visible in the +stages bar, at the top right are of the form.

+

The contact stage can be changed clicking on the stages bar.

+
+
+

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

+
    +
  • Open Source Integrators
  • +
+
+
+

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.

+

Current maintainer:

+

dreispt

+

This module is part of the OCA/partner-contact project on GitHub.

+

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

+
+
+
+ + diff --git a/partner_stage/tests/__init__.py b/partner_stage/tests/__init__.py new file mode 100644 index 00000000000..5f010342f4a --- /dev/null +++ b/partner_stage/tests/__init__.py @@ -0,0 +1 @@ +from . import test_partner_stage diff --git a/partner_stage/tests/test_partner_stage.py b/partner_stage/tests/test_partner_stage.py new file mode 100644 index 00000000000..fc99fd58c2b --- /dev/null +++ b/partner_stage/tests/test_partner_stage.py @@ -0,0 +1,78 @@ +# Copyright 2021 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo.exceptions import ValidationError +from odoo.tests.common import TransactionCase + +from .. import post_init_hook + + +class TestPartnerStage(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.Stage = cls.env["res.partner.stage"] + cls.Partner = cls.env["res.partner"] + + # Create some test partners without a stage + cls.partner_1 = cls.env["res.partner"].create( + { + "name": "Partner 1", + "stage_id": False, + } + ) + cls.partner_2 = cls.env["res.partner"].create( + { + "name": "Partner 2", + "stage_id": False, + } + ) + + def test_01_post_init_hook(self): + """Test post_init_hook sets the default stage on partners without stage_id""" + + # Ensure partners initially have no stage + self.assertFalse(self.partner_1.stage_id) + self.assertFalse(self.partner_2.stage_id) + + post_init_hook(self.env) + + # Reload the partners from the database to get the updated values + self.partner_1.invalidate_recordset() + self.partner_2.invalidate_recordset() + + # Check if partners' stages have been updated + self.assertEqual( + self.partner_1.stage_id, self.env.ref("partner_stage.partner_stage_active") + ) + self.assertEqual( + self.partner_2.stage_id, self.env.ref("partner_stage.partner_stage_active") + ) + self.assertEqual(self.partner_1.stage_id.state, "confirmed") + self.assertEqual(self.partner_2.stage_id.state, "confirmed") + + post_init_hook(self.env) + + # Reload the partners from the database to get the updated values + self.partner_1.invalidate_recordset() + self.partner_2.invalidate_recordset() + + # Check if partners' stages have been updated + self.assertEqual( + self.partner_1.stage_id, self.env.ref("partner_stage.partner_stage_active") + ) + self.assertEqual( + self.partner_2.stage_id, self.env.ref("partner_stage.partner_stage_active") + ) + self.assertEqual(self.partner_1.stage_id.state, "confirmed") + self.assertEqual(self.partner_2.stage_id.state, "confirmed") + + def test_02_partner_stage(self): + default_stage = self.env.ref("partner_stage.partner_stage_active") + new_partner = self.Partner.create({"name": "A Partner"}) + self.assertTrue(new_partner.stage_id, default_stage) + states = new_partner._read_group_stage_id(self.Stage, [], None) + self.assertTrue(states.ids, [1, 2, 3]) + + def test_03_stage_default_constraint(self): + with self.assertRaises(ValidationError): + self.Stage.create({"name": "Another Default Stage", "is_default": True}) diff --git a/partner_stage/views/res_partner_stage_views.xml b/partner_stage/views/res_partner_stage_views.xml new file mode 100644 index 00000000000..abb062fb2bb --- /dev/null +++ b/partner_stage/views/res_partner_stage_views.xml @@ -0,0 +1,55 @@ + + + + res.partner.stage + +
+ +
+
+ + + + + + + + + + + + +
+
+
+
+ + + res.partner.stage + + + + + + + + + + + + + Stage + res.partner.stage + list,form + + + + Contact Stages + + + +
diff --git a/partner_stage/views/res_partner_views.xml b/partner_stage/views/res_partner_views.xml new file mode 100644 index 00000000000..03853211c6b --- /dev/null +++ b/partner_stage/views/res_partner_views.xml @@ -0,0 +1,32 @@ + + + + res.partner + + + +
+ +
+
+
+
+ + + res.partner + + + + + + + +