[MIG] portal_hide_draft_order_details to 18.0

This commit is contained in:
Marc Durepos 2025-09-10 14:05:01 -04:00
parent 6accef74e2
commit 7b8255abe2
10 changed files with 240 additions and 0 deletions

View file

@ -0,0 +1,2 @@
from . import models
from . import wizard

View file

@ -0,0 +1,34 @@
#
# Bemade Inc.
#
# Copyright (C) 2023-June Bemade Inc. (<https://www.bemade.org>).
# 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",
}

View file

@ -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 ""
"<strong>Quotation is not yet ready. The details will be available once the "
"quotation is finalized.</strong>"
msgstr ""
"<strong>Ce devis n'est pas encore prêt. Les détails seront disponibles dès "
"que la soumission sera finalisée.</strong>"
#. 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."

View file

@ -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 ""
"<strong>Quotation is not yet ready. The details will be available once the "
"quotation is finalized.</strong>"
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 ""

View file

@ -0,0 +1 @@
from . import res_company

View file

@ -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.",
)

View file

@ -0,0 +1,50 @@
<odoo>
<template
id="portal_sale_order_customized"
inherit_id="sale.sale_order_portal_content"
>
<xpath expr="//section[@id='details']" position="attributes">
<attribute name="t-if">
not(sale_order.state == 'draft' and sale_order.company_id.so_visibility_draft_state)
</attribute>
</xpath>
<xpath expr="//section[@id='details']" position="after">
<t
t-if="sale_order.state == 'draft' and sale_order.company_id.so_visibility_draft_state"
>
<div class="alert alert-warning" role="alert">
<strong
>Quotation is not yet ready. The details will be available once the quotation is finalized.</strong>
</div>
</t>
</xpath>
</template>
<template
id="portal_sale_order_sidebar_customized"
inherit_id="sale.sale_order_portal_template"
>
<xpath expr="//t[@t-set='title']" position="attributes">
<attribute name="t-if">
not(sale_order.state == 'draft' and sale_order.company_id.so_visibility_draft_state)
</attribute>
</xpath>
<xpath expr="//t[@t-set='entries']/div/div" position="attributes">
<attribute name="t-if">
not(sale_order.state == 'draft' and sale_order.company_id.so_visibility_draft_state)
</attribute>
</xpath>
<div
t-if="sale_order._has_to_be_signed() or sale_order._has_to_be_paid()"
position="attributes"
>
<attribute name="t-if">
((sale_order._has_to_be_signed() or sale_order._has_to_be_paid())
and not(
sale_order.state == 'draft'
and sale_order.company_id.so_visibility_draft_state
)
)
</attribute>
</div>
</template>
</odoo>

View file

@ -0,0 +1 @@
from . import res_config_settings

View file

@ -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.",
)

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.bemade.fsm</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<block name="quotation_order_setting_container" position="inside">
<setting name="so_visibility_draft_state" company_dependent="1">
<field name="so_visibility_draft_state" />
</setting>
</block>
</field>
</record>
</odoo>