diff --git a/sale_substate/README.rst b/sale_substate/README.rst new file mode 100644 index 00000000000..24b5a2ab118 --- /dev/null +++ b/sale_substate/README.rst @@ -0,0 +1,100 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============== +Sale Sub State +============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:03f178d144b98915d3ba6b8ff0cbc71939c38af1dca237fc931936cc3e1552ff + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/19.0/sale_substate + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-19-0/sale-workflow-19-0-sale_substate + :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/sale-workflow&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to add a substate to sale order. For each sale order +state you can define a substate. With this module substates can be +defined allowing to extend the sales workflow. For example, you can add +substate "waiting for legal documents" if the order cannot be validated +without this document (sell a car for example). + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. | Go to \*\* Settings > Technical > Sub State Configuration \*\* and + Add "Base Substate". + | If necessary you can add "Target State values" (ex define a + substate for "cancel" state). Substate sequence is very important. + +2. Create a sale order and check if the substate are displayed on the + header of form view. Check if you can't set substate defined for sale + if sate is a quotation. + +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 +------- + +* Akretion + +Contributors +------------ + +- Mourad EL HADJ MIMOUNE +- Alexei Rivera (migration to 15.0) +- OERP Canada https://www.oerp.ca/: + + - Nishi Patel np@oerp.ca + +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/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_substate/__init__.py b/sale_substate/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/sale_substate/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_substate/__manifest__.py b/sale_substate/__manifest__.py new file mode 100644 index 00000000000..4f5b00d392b --- /dev/null +++ b/sale_substate/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2019 Akretion () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Sub State", + "version": "19.0.1.0.0", + "category": "Tools", + "author": "Akretion, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/sale-workflow", + "license": "AGPL-3", + "depends": ["base_substate", "sale_management"], + "data": [ + "views/sale_views.xml", + "data/sale_substate_mail_template_data.xml", + "data/sale_substate_data.xml", + "data/sale_substate_demo.xml", + ], + "installable": True, +} diff --git a/sale_substate/data/sale_substate_data.xml b/sale_substate/data/sale_substate_data.xml new file mode 100644 index 00000000000..fc611a28df0 --- /dev/null +++ b/sale_substate/data/sale_substate_data.xml @@ -0,0 +1,19 @@ + + + + Sale order Substate + sale.order + state + + + + Quotation + + draft + + + Sale + + sale + + diff --git a/sale_substate/data/sale_substate_demo.xml b/sale_substate/data/sale_substate_demo.xml new file mode 100644 index 00000000000..5a44fd49cdb --- /dev/null +++ b/sale_substate/data/sale_substate_demo.xml @@ -0,0 +1,47 @@ + + + + + In negotiation + 1 + + + + Won + 2 + + + + Lost + 3 + + + + Waiting for legal documents + 4 + + + + + To validate legal documents + 5 + + + + In delivering + 6 + + + + + Delivered + 7 + + + diff --git a/sale_substate/data/sale_substate_mail_template_data.xml b/sale_substate/data/sale_substate_mail_template_data.xml new file mode 100644 index 00000000000..56c885b7e86 --- /dev/null +++ b/sale_substate/data/sale_substate_mail_template_data.xml @@ -0,0 +1,63 @@ + + + + + Waiting for legal documents + + Reception of {{object.name}} + + +
+

+ Dear + customer +
+
+ Thank you for your order. +
+ In order to validate your order we need the legal documentation. +
+
+ Thank you, +
+ +
+ + +

+
+
+ {{ object.partner_id.lang }} + +
+ + In delivery + + Reception of {{object.name}} + + +
+

+ Dear + customer +
+ Thank you for your order. +
+ You order is being prepared for delivery. + You will receive a delivery tracking link to follow it. +
+
+ + Thank you, +
+ +
+ + +

+
+
+ {{ object.partner_id.lang }} + +
+
diff --git a/sale_substate/i18n/es.po b/sale_substate/i18n/es.po new file mode 100644 index 00000000000..5225ac67f30 --- /dev/null +++ b/sale_substate/i18n/es.po @@ -0,0 +1,210 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_substate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-09-02 18: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: sale_substate +#: model:mail.template,body_html:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "" +"
\n" +"

\n" +" Dear\n" +" customer\n" +"
\n" +"
\n" +" Thank you for your order.\n" +"
\n" +" In order to validate your order we need the legal documentation.\n" +"
\n" +"
\n" +" Thank you,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " +msgstr "" +"
\n" +"

\n" +" Estimado/a\n" +" customer\n" +"
\n" +"
\n" +" Gracias por su pedido.\n" +"
\n" +" IPara validar su pedido necesitamos la documentación legal..\n" +"
\n" +"
\n" +" Gracias,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " + +#. module: sale_substate +#: model:mail.template,body_html:sale_substate.mail_template_data_sale_substate_delivery +msgid "" +"
\n" +"

\n" +" Dear\n" +" customer\n" +"
\n" +" Thank you for your order.\n" +"
\n" +" You order is being prepared for delivery.\n" +" You will receive a delivery tracking link to follow it.\n" +"
\n" +"
\n" +"\n" +" Thank you,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " +msgstr "" +"
\n" +"

\n" +" Querido/a\n" +" customer\n" +"
\n" +" Gracias por su pedido.\n" +"
\n" +" Su pedido se está preparando para la entrega. \n" +" Usted recibirá un enlace de seguimiento de la entrega para " +"seguirla .\n" +"
\n" +"
\n" +"\n" +" Gracias,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " + +#. module: sale_substate +#: model:ir.model.fields,field_description:sale_substate.field_base_substate_type__model +msgid "Apply on" +msgstr "Aplicar sobre" + +#. module: sale_substate +#: model:ir.model,name:sale_substate.model_base_substate_type +msgid "Base Substate Type" +msgstr "Tipo de subestado base" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_delivered +msgid "Delivered" +msgstr "Entregado" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_in_delivery +msgid "In delivering" +msgstr "En entrega" + +#. module: sale_substate +#: model:mail.template,name:sale_substate.mail_template_data_sale_substate_delivery +msgid "In delivery" +msgstr "En entrega" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_under_nego +msgid "In negotiation" +msgstr "En negociación" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_lost +msgid "Lost" +msgstr "Perdido" + +#. module: sale_substate +#: model:target.state.value,name:sale_substate.target_state_value_draft +msgid "Quotation" +msgstr "Cotización" + +#. module: sale_substate +#: model:mail.template,subject:sale_substate.mail_template_data_sale_substate_delivery +#: model:mail.template,subject:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "Reception of {{object.name}}" +msgstr "Recepción de {{object.name}}" + +#. module: sale_substate +#: model:target.state.value,name:sale_substate.target_state_value_sale +msgid "Sale" +msgstr "Venta" + +#. module: sale_substate +#: model:ir.model.fields.selection,name:sale_substate.selection__base_substate_type__model__sale_order +msgid "Sale order" +msgstr "Pedido de venta" + +#. module: sale_substate +#: model:base.substate.type,name:sale_substate.base_substate_type_sale +msgid "Sale order Substate" +msgstr "Subestado de orden de venta" + +#. module: sale_substate +#: model:ir.model,name:sale_substate.model_sale_order +msgid "Sales Order" +msgstr "Órdenes de Venta" + +#. module: sale_substate +#: model:ir.model.fields,field_description:sale_substate.field_sale_order__substate_id +msgid "Sub State" +msgstr "Sub estado" + +#. module: sale_substate +#: model_terms:ir.ui.view,arch_db:sale_substate.view_sales_order_filter +msgid "Substate" +msgstr "Subestado" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_valid_docs +msgid "To validate legal documents" +msgstr "Para validar documentos legales" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_wait_docs +#: model:mail.template,name:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "Waiting for legal documents" +msgstr "A la espera de documentos legales" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_won +msgid "Won" +msgstr "Ganado" + +#, python-format +#~ msgid "" +#~ "The substate %(name)s is not defined for the state %(state)s but for " +#~ "%(target_state)s " +#~ msgstr "" +#~ "El subestado %(name)s no está definido para el estado %(state)s sino para " +#~ "%(target_state)s " diff --git a/sale_substate/i18n/it.po b/sale_substate/i18n/it.po new file mode 100644 index 00000000000..f5e4823a7bd --- /dev/null +++ b/sale_substate/i18n/it.po @@ -0,0 +1,211 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_substate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-05 10:38+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: sale_substate +#: model:mail.template,body_html:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "" +"
\n" +"

\n" +" Dear\n" +" customer\n" +"
\n" +"
\n" +" Thank you for your order.\n" +"
\n" +" In order to validate your order we need the legal documentation.\n" +"
\n" +"
\n" +" Thank you,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " +msgstr "" +"
\n" +"

\n" +" Spettabile\n" +" cliente\n" +"
\n" +"
\n" +" grazie per il suo odine.\n" +"
\n" +" Per poter validare il suo ordine abbiamo bisgno della documentazione " +"legale.\n" +"
\n" +"
\n" +" grazie,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " + +#. module: sale_substate +#: model:mail.template,body_html:sale_substate.mail_template_data_sale_substate_delivery +msgid "" +"
\n" +"

\n" +" Dear\n" +" customer\n" +"
\n" +" Thank you for your order.\n" +"
\n" +" You order is being prepared for delivery.\n" +" You will receive a delivery tracking link to follow it.\n" +"
\n" +"
\n" +"\n" +" Thank you,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " +msgstr "" +"
\n" +"

\n" +" Spettabile\n" +" cliente\n" +"
\n" +" grazie per il vosto ordine.\n" +"
\n" +" Il vostro ordine è in preparazione per la consegna.\n" +" Riceverete un collegamwnto di tracciamento della consegna per " +"seguirlo.\n" +"
\n" +"
\n" +"\n" +" grazie,\n" +"
\n" +" \n" +"
\n" +" \n" +"
\n" +"

\n" +"
\n" +" " + +#. module: sale_substate +#: model:ir.model.fields,field_description:sale_substate.field_base_substate_type__model +msgid "Apply on" +msgstr "Applica a" + +#. module: sale_substate +#: model:ir.model,name:sale_substate.model_base_substate_type +msgid "Base Substate Type" +msgstr "Tipo substato base" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_delivered +msgid "Delivered" +msgstr "Consegnato" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_in_delivery +msgid "In delivering" +msgstr "In consegna" + +#. module: sale_substate +#: model:mail.template,name:sale_substate.mail_template_data_sale_substate_delivery +msgid "In delivery" +msgstr "In cnsegna" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_under_nego +msgid "In negotiation" +msgstr "In contrattazione" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_lost +msgid "Lost" +msgstr "Persa" + +#. module: sale_substate +#: model:target.state.value,name:sale_substate.target_state_value_draft +msgid "Quotation" +msgstr "Preventivo" + +#. module: sale_substate +#: model:mail.template,subject:sale_substate.mail_template_data_sale_substate_delivery +#: model:mail.template,subject:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "Reception of {{object.name}}" +msgstr "Ricezione di {{object.name}}" + +#. module: sale_substate +#: model:target.state.value,name:sale_substate.target_state_value_sale +msgid "Sale" +msgstr "Vendita" + +#. module: sale_substate +#: model:ir.model.fields.selection,name:sale_substate.selection__base_substate_type__model__sale_order +msgid "Sale order" +msgstr "Ordini di vendita" + +#. module: sale_substate +#: model:base.substate.type,name:sale_substate.base_substate_type_sale +msgid "Sale order Substate" +msgstr "Substato ordine di vendita" + +#. module: sale_substate +#: model:ir.model,name:sale_substate.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#. module: sale_substate +#: model:ir.model.fields,field_description:sale_substate.field_sale_order__substate_id +msgid "Sub State" +msgstr "Substato" + +#. module: sale_substate +#: model_terms:ir.ui.view,arch_db:sale_substate.view_sales_order_filter +msgid "Substate" +msgstr "Substato" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_valid_docs +msgid "To validate legal documents" +msgstr "Documenti legali da validare" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_wait_docs +#: model:mail.template,name:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "Waiting for legal documents" +msgstr "Attesa documenti legali" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_won +msgid "Won" +msgstr "Vinta" + +#, python-format +#~ msgid "" +#~ "The substate %(name)s is not defined for the state %(state)s but for " +#~ "%(target_state)s " +#~ msgstr "" +#~ "il substato %(name)s non è definito per lo sato %(state)s ma per " +#~ "%(target_state)s " diff --git a/sale_substate/i18n/sale_substate.pot b/sale_substate/i18n/sale_substate.pot new file mode 100644 index 00000000000..71a140cc156 --- /dev/null +++ b/sale_substate/i18n/sale_substate.pot @@ -0,0 +1,157 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_substate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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: sale_substate +#: model:mail.template,body_html:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "" +"
\n" +"

\n" +" Dear\n" +" customer\n" +"
\n" +"
\n" +" Thank you for your order.\n" +"
\n" +" In order to validate your order we need the legal documentation.\n" +"
\n" +"
\n" +" Thank you,\n" +"
\n" +" \n" +"
\n" +" \n" +" \n" +"

\n" +"
\n" +" " +msgstr "" + +#. module: sale_substate +#: model:mail.template,body_html:sale_substate.mail_template_data_sale_substate_delivery +msgid "" +"
\n" +"

\n" +" Dear\n" +" customer\n" +"
\n" +" Thank you for your order.\n" +"
\n" +" You order is being prepared for delivery.\n" +" You will receive a delivery tracking link to follow it.\n" +"
\n" +"
\n" +"\n" +" Thank you,\n" +"
\n" +" \n" +"
\n" +" \n" +" \n" +"

\n" +"
\n" +" " +msgstr "" + +#. module: sale_substate +#: model:ir.model.fields,field_description:sale_substate.field_base_substate_type__model +msgid "Apply on" +msgstr "" + +#. module: sale_substate +#: model:ir.model,name:sale_substate.model_base_substate_type +msgid "Base Substate Type" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_delivered +msgid "Delivered" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_in_delivery +msgid "In delivering" +msgstr "" + +#. module: sale_substate +#: model:mail.template,name:sale_substate.mail_template_data_sale_substate_delivery +msgid "In delivery" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_under_nego +msgid "In negotiation" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_lost +msgid "Lost" +msgstr "" + +#. module: sale_substate +#: model:target.state.value,name:sale_substate.target_state_value_draft +msgid "Quotation" +msgstr "" + +#. module: sale_substate +#: model:mail.template,subject:sale_substate.mail_template_data_sale_substate_delivery +#: model:mail.template,subject:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "Reception of {{object.name}}" +msgstr "" + +#. module: sale_substate +#: model:target.state.value,name:sale_substate.target_state_value_sale +msgid "Sale" +msgstr "" + +#. module: sale_substate +#: model:ir.model.fields.selection,name:sale_substate.selection__base_substate_type__model__sale_order +msgid "Sale order" +msgstr "" + +#. module: sale_substate +#: model:base.substate.type,name:sale_substate.base_substate_type_sale +msgid "Sale order Substate" +msgstr "" + +#. module: sale_substate +#: model:ir.model,name:sale_substate.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_substate +#: model:ir.model.fields,field_description:sale_substate.field_sale_order__substate_id +msgid "Sub State" +msgstr "" + +#. module: sale_substate +#: model_terms:ir.ui.view,arch_db:sale_substate.view_sales_order_filter +msgid "Substate" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_valid_docs +msgid "To validate legal documents" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_wait_docs +#: model:mail.template,name:sale_substate.mail_template_data_sale_substate_wait_docs +msgid "Waiting for legal documents" +msgstr "" + +#. module: sale_substate +#: model:base.substate,name:sale_substate.base_substate_won +msgid "Won" +msgstr "" diff --git a/sale_substate/models/__init__.py b/sale_substate/models/__init__.py new file mode 100644 index 00000000000..6aacb753131 --- /dev/null +++ b/sale_substate/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/sale_substate/models/sale_order.py b/sale_substate/models/sale_order.py new file mode 100644 index 00000000000..66409eb8a48 --- /dev/null +++ b/sale_substate/models/sale_order.py @@ -0,0 +1,17 @@ +# Copyright 2019 Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class BaseSubstateType(models.Model): + _inherit = "base.substate.type" + + model = fields.Selection( + selection_add=[("sale.order", "Sale order")], ondelete={"sale.order": "cascade"} + ) + + +class SaleOrder(models.Model): + _inherit = ["sale.order", "base.substate.mixin"] + _name = "sale.order" diff --git a/sale_substate/pyproject.toml b/sale_substate/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_substate/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_substate/readme/CONTRIBUTORS.md b/sale_substate/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..a0bdf9b659e --- /dev/null +++ b/sale_substate/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Mourad EL HADJ MIMOUNE \<\> +- Alexei Rivera \<\> (migration to 15.0) +- OERP Canada : + - Nishi Patel diff --git a/sale_substate/readme/DESCRIPTION.md b/sale_substate/readme/DESCRIPTION.md new file mode 100644 index 00000000000..0d00e7fd4e7 --- /dev/null +++ b/sale_substate/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This module allows to add a substate to sale order. For each sale order +state you can define a substate. With this module substates can be +defined allowing to extend the sales workflow. For example, you can add +substate "waiting for legal documents" if the order cannot be validated +without this document (sell a car for example). diff --git a/sale_substate/readme/USAGE.md b/sale_substate/readme/USAGE.md new file mode 100644 index 00000000000..1ed654c611f --- /dev/null +++ b/sale_substate/readme/USAGE.md @@ -0,0 +1,7 @@ +1. Go to \*\* Settings \> Technical \> Sub State Configuration \*\* and Add "Base Substate". + If necessary you can add "Target State values" (ex define a substate + for "cancel" state). Substate sequence is very important. + +2. Create a sale order and check if the substate are displayed on the + header of form view. Check if you can't set substate defined for + sale if sate is a quotation. diff --git a/sale_substate/static/description/icon.png b/sale_substate/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_substate/static/description/icon.png differ diff --git a/sale_substate/static/description/index.html b/sale_substate/static/description/index.html new file mode 100644 index 00000000000..2a8fa1a99b8 --- /dev/null +++ b/sale_substate/static/description/index.html @@ -0,0 +1,455 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Sale Sub State

+ +

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

+

This module allows to add a substate to sale order. For each sale order +state you can define a substate. With this module substates can be +defined allowing to extend the sales workflow. For example, you can add +substate “waiting for legal documents” if the order cannot be validated +without this document (sell a car for example).

+

Table of contents

+ +
+

Usage

+
    +
  1. +
    Go to ** Settings > Technical > Sub State Configuration ** and +Add “Base Substate”.
    +
    If necessary you can add “Target State values” (ex define a +substate for “cancel” state). Substate sequence is very important.
    +
    +
  2. +
  3. Create a sale order and check if the substate are displayed on the +header of form view. Check if you can’t set substate defined for sale +if sate is a quotation.

    +
  4. +
+
+
+

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

+
    +
  • Akretion
  • +
+
+
+

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/sale-workflow project on GitHub.

+

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

+
+
+
+
+ + diff --git a/sale_substate/tests/__init__.py b/sale_substate/tests/__init__.py new file mode 100644 index 00000000000..ec06184eafb --- /dev/null +++ b/sale_substate/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_substate diff --git a/sale_substate/tests/test_sale_substate.py b/sale_substate/tests/test_sale_substate.py new file mode 100644 index 00000000000..cb699418d6f --- /dev/null +++ b/sale_substate/tests/test_sale_substate.py @@ -0,0 +1,75 @@ +# Copyright 2019 Akretion Mourad EL HADJ MIMOUNE +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.exceptions import ValidationError +from odoo.tests import tagged +from odoo.tests.common import TransactionCase + + +@tagged("-at_install", "post_install", "with_demo") +class TestBaseSubstate(TransactionCase): + def setUp(self): + super().setUp() + self.substate_test_sale = self.env["sale.order"] + self.substate_test_sale_line = self.env["sale.order.line"] + + self.substate_under_nego = self.env.ref( + "sale_substate.base_substate_under_nego" + ) + self.substate_won = self.env.ref("sale_substate.base_substate_won") + self.substate_wait_docs = self.env.ref("sale_substate.base_substate_wait_docs") + self.substate_valid_docs = self.env.ref( + "sale_substate.base_substate_valid_docs" + ) + self.substate_in_delivery = self.env.ref( + "sale_substate.base_substate_in_delivery" + ) + self.product_1 = self.env["product.product"].create( + { + "name": "Test Product 1", + "type": "service", + } + ) + + def test_sale_order_substate(self): + partner = self.env["res.partner"].create( + { + "name": "Test Partner", + "email": "test@example.com", + } + ) + so_test1 = self.substate_test_sale.create( + { + "name": "Test base substate to basic sale", + "partner_id": partner.id, + "order_line": [ + ( + 0, + 0, + { + "product_id": self.product_1.id, + "product_uom_qty": 2, + "product_uom_id": self.product_1.uom_id.id, + "name": "line test", + "price_unit": 120.0, + }, + ) + ], + } + ) + self.assertTrue(so_test1.state == "draft") + self.assertTrue(so_test1.substate_id == self.substate_under_nego) + + # Block substate not corresponding to draft state + with self.assertRaises(ValidationError): + so_test1.substate_id = self.substate_valid_docs + # Test that validation of sale order change substate_id + so_test1.action_confirm() + self.assertTrue(so_test1.state == "sale") + self.assertTrue(so_test1.substate_id == self.substate_valid_docs) + + # Test that substate_id is set to false if + # there is not substate corresponding to state + so_test1._action_cancel() + self.assertTrue(so_test1.state == "cancel") + self.assertTrue(not so_test1.substate_id) diff --git a/sale_substate/views/sale_views.xml b/sale_substate/views/sale_views.xml new file mode 100644 index 00000000000..5bb644739d9 --- /dev/null +++ b/sale_substate/views/sale_views.xml @@ -0,0 +1,59 @@ + + + + + sale.order + + + +
+ +
+
+
+
+ + + sale.order + + + + + + + + + + sale.order + + + + + + + + + + sale.order + + + + + + + + + + +
diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000000..10312cb7c16 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-base_substate @ git+https://github.com/OCA/server-ux.git@refs/pull/1198/head#subdirectory=base_substate