diff --git a/portal_hide_draft_order_details/__init__.py b/portal_hide_draft_order_details/__init__.py new file mode 100644 index 0000000..9b42961 --- /dev/null +++ b/portal_hide_draft_order_details/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizard diff --git a/portal_hide_draft_order_details/__manifest__.py b/portal_hide_draft_order_details/__manifest__.py new file mode 100644 index 0000000..9ded409 --- /dev/null +++ b/portal_hide_draft_order_details/__manifest__.py @@ -0,0 +1,34 @@ +# +# Bemade Inc. +# +# Copyright (C) 2023-June Bemade Inc. (). +# Author: Benoît Vézina (Contact : benoit@bemade.org) +# +# This program is under the terms of the GNU Lesser General Public License, +# version 3. +# +# For full license details, see https://www.gnu.org/licenses/lgpl-3.0.en.html. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +{ + "name": "Portal Order Line Hiding with Company Settings", + "version": "18.0.1.0.0", + "summary": "Hide order lines on the portal based on a company setting when the Sales Order is in draft state.", + "author": "Bemade Inc.", + "depends": ["website_sale"], + "data": [ + "views/sale_order_portal_templates.xml", + "wizard/res_config_settings.xml", + ], + "installable": True, + "application": False, + "website": "http://www.bemade.org", + "license": "LGPL-3", +} diff --git a/portal_hide_draft_order_details/i18n/fr.po b/portal_hide_draft_order_details/i18n/fr.po new file mode 100644 index 0000000..30053c7 --- /dev/null +++ b/portal_hide_draft_order_details/i18n/fr.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * portal_hide_draft_order_details +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-15 14:41+0000\n" +"PO-Revision-Date: 2024-08-15 14:41+0000\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: portal_hide_draft_order_details +#: model_terms:ir.ui.view,arch_db:portal_hide_draft_order_details.portal_sale_order_customized +msgid "" +"Quotation is not yet ready. The details will be available once the " +"quotation is finalized." +msgstr "" +"Ce devis n'est pas encore prêt. Les détails seront disponibles dès " +"que la soumission sera finalisée." + +#. module: portal_hide_draft_order_details +#: model:ir.model,name:portal_hide_draft_order_details.model_res_company +msgid "Companies" +msgstr "Sociétés" + +#. module: portal_hide_draft_order_details +#: model:ir.model.fields,field_description:portal_hide_draft_order_details.field_res_config_settings__company_id +msgid "Company" +msgstr "Société" + +#. module: portal_hide_draft_order_details +#: model:ir.model,name:portal_hide_draft_order_details.model_res_config_settings +msgid "Config Settings" +msgstr "Paramètres de configuration" + +#. module: portal_hide_draft_order_details +#: model:ir.model.fields,field_description:portal_hide_draft_order_details.field_res_company__so_visibility_draft_state +#: model:ir.model.fields,field_description:portal_hide_draft_order_details.field_res_config_settings__so_visibility_draft_state +msgid "Hide SO Lines in Draft State" +msgstr "Cacher les détails des commandes de ventes en état brouillon" + +#. module: portal_hide_draft_order_details +#: model:ir.model.fields,help:portal_hide_draft_order_details.field_res_company__so_visibility_draft_state +#: model:ir.model.fields,help:portal_hide_draft_order_details.field_res_config_settings__so_visibility_draft_state +msgid "" +"If enabled, sales order lines will be hidden in the portal when the sales " +"order is in draft state." +msgstr "" +"Quand cette option est sélectionnée, les produits et prix sur les soumissions en état " +"brouillon seront cachés." diff --git a/portal_hide_draft_order_details/i18n/portal_hide_draft_order_details.pot b/portal_hide_draft_order_details/i18n/portal_hide_draft_order_details.pot new file mode 100644 index 0000000..03e4ad8 --- /dev/null +++ b/portal_hide_draft_order_details/i18n/portal_hide_draft_order_details.pot @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * portal_hide_draft_order_details +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-15 14:41+0000\n" +"PO-Revision-Date: 2024-08-15 14:41+0000\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: portal_hide_draft_order_details +#: model_terms:ir.ui.view,arch_db:portal_hide_draft_order_details.portal_sale_order_customized +msgid "" +"Quotation is not yet ready. The details will be available once the " +"quotation is finalized." +msgstr "" + +#. module: portal_hide_draft_order_details +#: model:ir.model,name:portal_hide_draft_order_details.model_res_company +msgid "Companies" +msgstr "" + +#. module: portal_hide_draft_order_details +#: model:ir.model.fields,field_description:portal_hide_draft_order_details.field_res_config_settings__company_id +msgid "Company" +msgstr "" + +#. module: portal_hide_draft_order_details +#: model:ir.model,name:portal_hide_draft_order_details.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: portal_hide_draft_order_details +#: model:ir.model.fields,field_description:portal_hide_draft_order_details.field_res_company__so_visibility_draft_state +#: model:ir.model.fields,field_description:portal_hide_draft_order_details.field_res_config_settings__so_visibility_draft_state +msgid "Hide SO Lines in Draft State" +msgstr "" + +#. module: portal_hide_draft_order_details +#: model:ir.model.fields,help:portal_hide_draft_order_details.field_res_company__so_visibility_draft_state +#: model:ir.model.fields,help:portal_hide_draft_order_details.field_res_config_settings__so_visibility_draft_state +msgid "" +"If enabled, sales order lines will be hidden in the portal when the sales " +"order is in draft state." +msgstr "" diff --git a/portal_hide_draft_order_details/models/__init__.py b/portal_hide_draft_order_details/models/__init__.py new file mode 100644 index 0000000..aff44f3 --- /dev/null +++ b/portal_hide_draft_order_details/models/__init__.py @@ -0,0 +1 @@ +from . import res_company diff --git a/portal_hide_draft_order_details/models/res_company.py b/portal_hide_draft_order_details/models/res_company.py new file mode 100644 index 0000000..ae9fe72 --- /dev/null +++ b/portal_hide_draft_order_details/models/res_company.py @@ -0,0 +1,12 @@ +from odoo import models, fields + + +class ResCompany(models.Model): + _inherit = "res.company" + + so_visibility_draft_state = fields.Boolean( + string="Hide SO Lines in Draft State", + default=False, + help="If enabled, sales order lines will be hidden in the portal when the " + "sales order is in draft state.", + ) diff --git a/portal_hide_draft_order_details/views/sale_order_portal_templates.xml b/portal_hide_draft_order_details/views/sale_order_portal_templates.xml new file mode 100644 index 0000000..e942fe2 --- /dev/null +++ b/portal_hide_draft_order_details/views/sale_order_portal_templates.xml @@ -0,0 +1,50 @@ + + + + diff --git a/portal_hide_draft_order_details/wizard/__init__.py b/portal_hide_draft_order_details/wizard/__init__.py new file mode 100644 index 0000000..0deb68c --- /dev/null +++ b/portal_hide_draft_order_details/wizard/__init__.py @@ -0,0 +1 @@ +from . import res_config_settings diff --git a/portal_hide_draft_order_details/wizard/res_config_settings.py b/portal_hide_draft_order_details/wizard/res_config_settings.py new file mode 100644 index 0000000..328dd4a --- /dev/null +++ b/portal_hide_draft_order_details/wizard/res_config_settings.py @@ -0,0 +1,17 @@ +from odoo import models, fields + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + company_id = fields.Many2one( + comodel_name="res.company", + default=lambda self: self.env.company or self.env.user.company_id, + ) + + so_visibility_draft_state = fields.Boolean( + string="Hide SO Lines in Draft State", + related="company_id.so_visibility_draft_state", + readonly=False, + help="If enabled, sales order lines will be hidden in the portal when the sales order is in draft state.", + ) diff --git a/portal_hide_draft_order_details/wizard/res_config_settings.xml b/portal_hide_draft_order_details/wizard/res_config_settings.xml new file mode 100644 index 0000000..9c00515 --- /dev/null +++ b/portal_hide_draft_order_details/wizard/res_config_settings.xml @@ -0,0 +1,15 @@ + + + + res.config.settings.view.form.inherit.bemade.fsm + res.config.settings + + + + + + + + + +