[IMP] rma_sale: portal ux

When the user selects an operation, the comment shows up so the customer
doesn't forget to enter his comments
This commit is contained in:
david
2021-03-01 18:54:56 +01:00
committed by Chafique
parent e2bfab1c83
commit b46bfac325
3 changed files with 50 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
/* Copyright 2021 Tecnativa - David Vidal
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
odoo.define("rma_sale.animation", function(require) {
"use strict";
var sAnimation = require("website.content.snippets.animation");
// In the customer portal when a RMA operation is selected show the comments
// selector so the user doesn't miss the chance to add his comments
sAnimation.registry.rma_operation_portal = sAnimation.Class.extend({
selector: ".rma-operation",
start: function() {
this.id = this.el.name.replace("-operation_id", "");
this.$comment = $("#comment-" + this.id);
this.$comment_input = $("[name='" + this.id + "-description']");
var _this = this;
this.$el.on("change", function() {
_this._onChangeOperationId();
});
},
_show_comment: function() {
if (this.$comment) {
this.$comment.removeClass("show");
this.$comment.addClass("show");
if (this.$comment_input) {
this.$comment_input.focus();
}
}
},
_hide_comment: function() {
if (this.$comment) {
this.$comment.removeClass("show");
}
},
_onChangeOperationId: function() {
// Toggle comment on or off if an operation is requested
if (this.$el && this.$el.val()) {
this._show_comment();
} else {
this._hide_comment();
}
},
});
});

View File

@@ -2,6 +2,10 @@
<odoo>
<template id="assets_frontend" inherit_id="web.assets_frontend" name="Request RMA">
<xpath expr="//link[last()]" position="after">
<script
type="text/javascript"
src="/rma_sale/static/src/js/rma_portal_form.js"
/>
<link
rel="stylesheet"
type="text/scss"

View File

@@ -143,7 +143,7 @@
<td class="text-left">
<select
t-attf-name="#{data_index}-operation_id"
class="form-control"
class="form-control rma-operation"
>
<option value="">---</option>
<t