[REV] pos_self_order, product, website_sale: add product info popup
This reverts commit 3b9401c354.
It shouldn't have been merged in the first place. The PR was `r-` but it
seems like the mergebot bugged and still merged it because there was an
occurence of `r+` in the sentence which asked robodoo to `r-`.
> robodoo r- just to be sure, since there was a random r+ not [...]
Rationale of the revert:
- Bad field name:
- "ecommerce" in product module
- "ecommerce" but used in POS
- Arguably very low value to share the field -> This field is used in
ecommerce to add info exactly between the price and the name of a
product. There is low chance that you want to share that exact
information with the POS.
- Technically, it couldn't work. What you design in website builder on
the product page is related to website assets JS and CSS, which are
not loaded neither in the backend and neither in the POS.
It was leading to multiple critical issues, mainly:
- Losing the whole style of the content (CSS)
- Breaking completly the snippets (visually and design wise) (CSS/JS)
- Not even show (JS is in charge of showing the content eg)
Note that the same issues were already existing in that field in the
backend (it's shown in the product form view). The ecommerce team was
looking for a solution to make it work, but it's impossible as to work,
it would need the website / frontend assets, which can't be loaded in
the backend / POS.
The cancel of this PR was validated with PO of POS and ecommerce
following those explanation, which they weren't aware of.
Apart from this revert, further PR will be done to:
1. Remove the field from the product form view (ecommerce app)
2. Create a new field for POS
Revert of https://github.com/odoo/odoo/pull/136906
task-3524272
closes odoo/odoo#137514
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
@@ -94,9 +94,6 @@
|
||||
<xpath expr="//page[@name='invoicing']" position="attributes">
|
||||
<attribute name="invisible">detailed_type == "combo"</attribute>
|
||||
</xpath>
|
||||
<group name="ecommerce_description" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -64,8 +64,6 @@
|
||||
'web/static/lib/bootstrap/js/dist/scrollspy.js',
|
||||
"pos_self_order/static/src/app/**/*",
|
||||
"point_of_sale/static/src/app/store/models/product_custom_attribute.js",
|
||||
'web_editor/static/src/js/editor/odoo-editor/src/base_style.scss',
|
||||
'web_editor/static/src/scss/web_editor.common.scss',
|
||||
],
|
||||
# Assets tests
|
||||
"pos_self_order.assets_tests": [
|
||||
|
||||
@@ -117,7 +117,7 @@ class ProductProduct(models.Model):
|
||||
"attributes": self._get_attributes(pos_config),
|
||||
"name": self._get_name(),
|
||||
"id": self.id,
|
||||
"description_ecommerce": self.description_ecommerce,
|
||||
"description_sale": self.description_sale,
|
||||
"pos_categ_ids": self.pos_categ_ids.mapped("name") or ["Other"],
|
||||
"pos_combo_ids": self.combo_ids.mapped("id") or False,
|
||||
"is_pos_groupable": self.uom_id.is_pos_groupable,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Component, useRef } from "@odoo/owl";
|
||||
import { useSelfOrder } from "@pos_self_order/app/self_order_service";
|
||||
import { useService, useForwardRefToParent } from "@web/core/utils/hooks";
|
||||
import { Line } from "@pos_self_order/app/models/line";
|
||||
import { ProductInfoPopup } from "@pos_self_order/app/components/product_info_popup/product_info_popup";
|
||||
|
||||
export class ProductCard extends Component {
|
||||
static template = "pos_self_order.ProductCard";
|
||||
@@ -16,7 +15,6 @@ export class ProductCard extends Component {
|
||||
setup() {
|
||||
this.selfOrder = useSelfOrder();
|
||||
this.router = useService("router");
|
||||
this.dialog = useService("dialog");
|
||||
|
||||
useForwardRefToParent("currentProductCard");
|
||||
}
|
||||
@@ -111,11 +109,4 @@ export class ProductCard extends Component {
|
||||
await this.selfOrder.getPricesFromServer();
|
||||
}
|
||||
}
|
||||
|
||||
getProductInfo() {
|
||||
this.dialog.add(ProductInfoPopup, {
|
||||
product: this.props.product,
|
||||
title: this.props.product.name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
width: 100%;
|
||||
display:flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
|
||||
.o_self_order_item_card_image {
|
||||
width: 100%;
|
||||
@@ -29,22 +28,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.product-information-tag {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 0 40px 40px 0;
|
||||
border-color: transparent #9a9ea180 transparent transparent;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.product-information-tag-logo {
|
||||
position: absolute;
|
||||
left: 25px;
|
||||
top: 4px;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
<button class="self_order_product_card btn btn-light m-0 overflow-hidden border fw-bolder"
|
||||
t-on-click="selectProduct"
|
||||
t-ref="selfProductCard">
|
||||
<div t-if="props.product.description_ecommerce" class="product-information-tag" t-on-click.prevent.stop="getProductInfo">
|
||||
<i class="product-information-tag-logo fa fa-info fs-4" role="img" aria-label="Product Information" title="Product Information" />
|
||||
</div>
|
||||
<img
|
||||
class="o_self_order_item_card_image rounded bg-view"
|
||||
t-attf-src="/menu/get-image/{{ props.product.id }}/512?unique={{props.product.write_date}}"
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { Component, useExternalListener } from "@odoo/owl";
|
||||
|
||||
export class ProductInfoPopup extends Component {
|
||||
static template = "pos_self_order.ProductInfoPopup";
|
||||
static props = ["product"];
|
||||
|
||||
setup() {
|
||||
useExternalListener(window, "click", this.props.close);
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
.self_order_product_info_popup {
|
||||
.modal-dialog {
|
||||
height: auto !important;
|
||||
top: 20%;
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="pos_self_order.ProductInfoPopup" owl="1">
|
||||
<div class="self_order_product_info_popup o_dialog" t-att-id="id">
|
||||
<div role="dialog" class="modal d-block" tabindex="-1">
|
||||
<div class="modal-dialog" role="document" t-on-click.stop="">
|
||||
<div class="modal-content rounded">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fw-bolder" t-esc="props.product.name"/>
|
||||
<button type="button" class="btn-close" t-on-click.stop="() => this.props.close()"></button>
|
||||
</div>
|
||||
<span class="modal-body o_self_order_main_desc fs-3 fw-bolder p-4 ps-5 overflow-auto" t-out="props.product.description_ecommerce" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @odoo-module **/
|
||||
import { Reactive } from "@web/core/utils/reactive";
|
||||
import { markup } from "@odoo/owl";
|
||||
|
||||
export class Product extends Reactive {
|
||||
constructor(
|
||||
@@ -10,7 +9,7 @@ export class Product extends Reactive {
|
||||
attributes,
|
||||
name,
|
||||
id,
|
||||
description_ecommerce,
|
||||
description_sale,
|
||||
pos_categ_ids,
|
||||
pos_combo_ids,
|
||||
is_pos_groupable,
|
||||
@@ -30,9 +29,7 @@ export class Product extends Reactive {
|
||||
this.has_image = product.has_image;
|
||||
this.attributes = product.attributes;
|
||||
this.name = product.name;
|
||||
this.description_ecommerce = product.description_ecommerce
|
||||
? markup(product.description_ecommerce)
|
||||
: false;
|
||||
this.description_sale = product.description_sale;
|
||||
this.pos_categ_ids = product.pos_categ_ids;
|
||||
this.pos_combo_ids = product.pos_combo_ids;
|
||||
this.is_pos_groupable = product.is_pos_groupable;
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
onerror="this.remove()" />
|
||||
<div class="d-flex flex-column justify-content-center w-75 p-3 ps-0">
|
||||
<span class="fs-1 fw-bolder" t-esc="state.selectedProduct.name"/>
|
||||
<div t-if="state.selectedProduct.description_ecommerce"
|
||||
<div t-if="state.selectedProduct.description_sale"
|
||||
class="o_self_order_main_desc text-muted overflow-y-auto"
|
||||
t-esc="state.selectedProduct.description_ecommerce"
|
||||
t-esc="state.selectedProduct.description_sale"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<t t-set="availableProducts" t-value="!state.searchInput ? products : getFilteredProducts(products)" />
|
||||
<h2 t-if="availableProducts.length > 0" class="pt-3 pb-1 px-4 m-0 fs-3" t-esc="category.name" />
|
||||
<t t-foreach="availableProducts" t-as="product" t-key="product.id">
|
||||
<ProductCard product="product" currentProductCard="product.id === selfOrder.lastEditedProductId and currentProductCard"/>
|
||||
<ProductCard product="product" currentProductCard="product.id === selfOrder.lastEditedProductId and currentProductCard" />
|
||||
</t>
|
||||
</section>
|
||||
<p t-if="getFilteredProducts(selfOrder.products).length === 0" class="mx-auto mt-3 text-center">No products found</p>
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
onerror="this.remove()" />
|
||||
<div class="d-flex flex-column flex-grow-1 w-75 justify-content-start p-4 rounded shadow-sm bg-view overflow-auto">
|
||||
<h1 class="fw-bolder" t-esc="product.name"/>
|
||||
<span t-if="product.description_ecommerce"
|
||||
<span t-if="product.description_sale"
|
||||
class="o_self_order_main_desc flex-grow-1 pb-3 mb-3 bg-view text-muted "
|
||||
t-esc="product.description_ecommerce"
|
||||
t-esc="product.description_sale"
|
||||
/>
|
||||
<span class="fs-3 fw-bolder" t-esc="selfOrder.formatMonetary(product.prices)"/>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,6 @@ from collections import defaultdict
|
||||
from odoo import api, fields, models, tools, _, SUPERUSER_ID
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools.translate import html_translate
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
PRICE_CONTEXT_KEYS = ['pricelist', 'quantity', 'uom', 'date']
|
||||
@@ -49,13 +48,6 @@ class ProductTemplate(models.Model):
|
||||
'Sales Description', translate=True,
|
||||
help="A description of the Product that you want to communicate to your customers. "
|
||||
"This description will be copied to every Sales Order, Delivery Order and Customer Invoice/Credit Note")
|
||||
description_ecommerce = fields.Html(
|
||||
string="eCommerce Description",
|
||||
translate=html_translate,
|
||||
sanitize_overridable=True,
|
||||
sanitize_attributes=False,
|
||||
sanitize_form=False,
|
||||
)
|
||||
detailed_type = fields.Selection([
|
||||
('consu', 'Consumable'),
|
||||
('service', 'Service')], string='Product Type', default='consu', required=True,
|
||||
|
||||
@@ -104,12 +104,6 @@
|
||||
<page string="Sales" name="sales" invisible="1">
|
||||
<group name="sale">
|
||||
<group string="Upsell & Cross-Sell" name="upsell" invisible="1"/>
|
||||
<group string="eCommerce Description" name="ecommerce_description" invisible="1">
|
||||
<field name="description_ecommerce"
|
||||
placeholder="This note is added to the product page on your eCommerce/Point of Sale shop"
|
||||
nolabel="1"
|
||||
colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group string="Sales Description" name="description">
|
||||
|
||||
@@ -48,6 +48,13 @@ class ProductTemplate(models.Model):
|
||||
sanitize_attributes=False,
|
||||
sanitize_form=False,
|
||||
)
|
||||
description_ecommerce = fields.Html(
|
||||
string="eCommerce Description",
|
||||
translate=html_translate,
|
||||
sanitize_overridable=True,
|
||||
sanitize_attributes=False,
|
||||
sanitize_form=False,
|
||||
)
|
||||
|
||||
alternative_product_ids = fields.Many2many(
|
||||
string="Alternative Products",
|
||||
|
||||
@@ -157,9 +157,6 @@
|
||||
invisible="not sale_ok"
|
||||
placeholder="Displayed in bottom of product pages"/>
|
||||
</group>
|
||||
<group name="ecommerce_description" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</group>
|
||||
<xpath expr="//page[@name='sales']/group[@name='sale']" position="inside">
|
||||
<group string="eCommerce Shop" name="shop" invisible="not sale_ok">
|
||||
<field name="website_url" invisible="1"/>
|
||||
@@ -171,6 +168,12 @@
|
||||
<group name="product_template_images" string="Extra Product Media" invisible="not sale_ok">
|
||||
<field name="product_template_image_ids" class="o_website_sale_image_list" context="{'default_name': name}" mode="kanban" add-label="Add a Media" nolabel="1"/>
|
||||
</group>
|
||||
<group string="eCommerce Description">
|
||||
<field name="description_ecommerce"
|
||||
placeholder="This note is added to the product page on your eCommerce shop"
|
||||
nolabel="1"
|
||||
colspan="2"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user