Skip to content

Commit 2c78343

Browse files
committed
[MIG] rma_sale: Migration to 18.0
TT54264
1 parent 1de133a commit 2c78343

22 files changed

+227
-375
lines changed

rma_sale/__manifest__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"name": "Return Merchandise Authorization Management - Link with Sales",
88
"summary": "Sale Order - Return Merchandise Authorization (RMA)",
9-
"version": "16.0.3.1.0",
9+
"version": "18.0.1.0.0",
1010
"development_status": "Production/Stable",
1111
"category": "RMA",
1212
"website": "https://github.com/OCA/rma",
@@ -26,7 +26,7 @@
2626
],
2727
"assets": {
2828
"web.assets_frontend": [
29-
"/rma_sale/static/src/js/rma_portal_form.js",
29+
"/rma_sale/static/src/js/rma_portal_form.esm.js",
3030
"/rma_sale/static/src/scss/rma_sale.scss",
3131
],
3232
"web.assets_tests": [

rma_sale/i18n/de.po

-9
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,3 @@ msgid ""
495495
msgstr ""
496496
"Sie sind dabei, eine RMA-Anfrage durchzuführen. Unser Team wird es "
497497
"bearbeiten und Sie erreichen, sobald es validiert ist. Denk daran, dass:"
498-
499-
#~ msgid "<strong>Requested operation:</strong>"
500-
#~ msgstr "<strong>Angeforderte Operation:</strong>"
501-
502-
#~ msgid "<strong>Sale order:</strong>"
503-
#~ msgstr "<strong>Verkaufsauftrag:</strong>"
504-
505-
#~ msgid "Stock Move"
506-
#~ msgstr "Lagerbewegung"

rma_sale/i18n/es.po

-37
Original file line numberDiff line numberDiff line change
@@ -490,40 +490,3 @@ msgid ""
490490
msgstr ""
491491
"Va a realizar una petición de RMA. Nuestro equipo la procesará y se pondrá "
492492
"en contacto con usted una vez validad. Tenga en cuenta que:"
493-
494-
#~ msgid "<strong>Requested operation:</strong>"
495-
#~ msgstr "<strong>Operación solicitada:</strong>"
496-
497-
#~ msgid "<strong>Sale order:</strong>"
498-
#~ msgstr "<strong>Orden de venta:</strong>"
499-
500-
#~ msgid "Stock Move"
501-
#~ msgstr "Movimiento de existencias"
502-
503-
#~ msgid ""
504-
#~ "<span>\n"
505-
#~ " If an RMA has already been created for a "
506-
#~ "product in this sales order, it will not\n"
507-
#~ " be possible to create another one from "
508-
#~ "the web portal.\n"
509-
#~ " </span>"
510-
#~ msgstr ""
511-
#~ "<span>\n"
512-
#~ " Si ya se ha creado un RMA para un "
513-
#~ "producto de esta orden de venta, no será\n"
514-
#~ " posible crear otro desde el portal web.\n"
515-
#~ " </span>"
516-
517-
#~ msgid "Domain Move"
518-
#~ msgstr "Dominio de movimientos"
519-
520-
#~ msgid "Domain Picking"
521-
#~ msgstr "Dominio de entregas"
522-
523-
#~ msgid "Domain Product"
524-
#~ msgstr "Dominio de productos"
525-
526-
#, fuzzy
527-
#~| msgid "Delivery"
528-
#~ msgid "Is Sale Delivery"
529-
#~ msgstr "Es entrega de orden de venta"

rma_sale/i18n/fr.po

-9
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,3 @@ msgid ""
491491
msgstr ""
492492
"Vous êtes sur le point d'effectuer une demande RMA. Notre équipe le traitera "
493493
"et vous parviendra une fois validé. Garde en tête que:"
494-
495-
#~ msgid "<strong>Requested operation:</strong>"
496-
#~ msgstr "<strong>Opération demandée:</strong>"
497-
498-
#~ msgid "<strong>Sale order:</strong>"
499-
#~ msgstr "<strong>Bon de commande:</strong>"
500-
501-
#~ msgid "Stock Move"
502-
#~ msgstr "mouvement de stock"

rma_sale/i18n/it.po

-9
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,3 @@ msgid ""
487487
msgstr ""
488488
"Stai per eseguire una richiesta RMA. Il nostro team lo elaborerà e ti "
489489
"arriverà una volta convalidato. Tieni presente che:"
490-
491-
#~ msgid "<strong>Requested operation:</strong>"
492-
#~ msgstr "<strong>Operazione richiesta:</strong>"
493-
494-
#~ msgid "<strong>Sale order:</strong>"
495-
#~ msgstr "<strong>Ordine di vendita:</strong>"
496-
497-
#~ msgid "Stock Move"
498-
#~ msgstr "Movimento di magazzino"

rma_sale/i18n/nl.po

-3
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,3 @@ msgid ""
478478
msgstr ""
479479
"U staat op het punt een RMA verzoek in te dienen. Ons team zal de aanvraag "
480480
"verwerken. Let op dat:"
481-
482-
#~ msgid "Stock Move"
483-
#~ msgstr "Voorraad aanpassing"

rma_sale/i18n/pt.po

-9
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,3 @@ msgid ""
490490
msgstr ""
491491
"Você está prestes a realizar um pedido de RMA. A nossa equipa irá processá-"
492492
"lo e entrará em contacto assim que for validado. Tenha presente que:"
493-
494-
#~ msgid "<strong>Requested operation:</strong>"
495-
#~ msgstr "<strong>Operação Requerida:</strong>"
496-
497-
#~ msgid "<strong>Sale order:</strong>"
498-
#~ msgstr "<strong>Encomenda de Venda:</strong>"
499-
500-
#~ msgid "Stock Move"
501-
#~ msgstr "Movimento de Stock"

rma_sale/i18n/pt_BR.po

-21
Original file line numberDiff line numberDiff line change
@@ -472,24 +472,3 @@ msgid ""
472472
"You're about to perform an RMA request. Our team will process it an will "
473473
"reach you once it's validated. Keep in mind that:"
474474
msgstr ""
475-
476-
#~ msgid "<strong>Requested operation:</strong>"
477-
#~ msgstr "<strong>Operação Requerida:</strong>"
478-
479-
#~ msgid "<strong>Sale order:</strong>"
480-
#~ msgstr "<strong>Pedido de Venda:</strong>"
481-
482-
#~ msgid ""
483-
#~ "<span>\n"
484-
#~ " If an RMA has already been created for a "
485-
#~ "product in this sales order, it will not\n"
486-
#~ " be possible to create another one from "
487-
#~ "the web portal.\n"
488-
#~ " </span>"
489-
#~ msgstr ""
490-
#~ "<span>\n"
491-
#~ " Se um RMA já houver sido criado para um "
492-
#~ "produto no pedido de venda,\n"
493-
#~ " não será possível criar outro através do "
494-
#~ "portal web.\n"
495-
#~ " </span>"

rma_sale/i18n/ro.po

-9
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,3 @@ msgid ""
482482
msgstr ""
483483
"Sunteți pe cale să efectuați o solicitare de retur. Echipa noastră o va "
484484
"procesa odată ce va fi validată. Ține minte că:"
485-
486-
#~ msgid "<strong>Requested operation:</strong>"
487-
#~ msgstr "<strong>Operație solicitată:</strong>"
488-
489-
#~ msgid "<strong>Sale order:</strong>"
490-
#~ msgstr "<strong>Comandă vânzare:</strong>"
491-
492-
#~ msgid "Stock Move"
493-
#~ msgstr "Mișcare stoc"

rma_sale/models/sale.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def action_create_rma(self):
6161

6262
def action_view_rma(self):
6363
self.ensure_one()
64-
action = self.sudo().env.ref("rma.rma_action").read()[0]
64+
action = self.env["ir.actions.act_window"]._for_xml_id("rma.rma_action")
6565
rma = self.rma_ids
6666
if len(rma) == 1:
6767
action.update(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/* Copyright 2021 Tecnativa - David Vidal
2+
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
3+
4+
import publicWidget from "@web/legacy/js/public/public_widget";
5+
6+
publicWidget.registry.PortalRmaSale = publicWidget.Widget.extend({
7+
selector: "#form-request-rma",
8+
events: {
9+
"change .rma-operation": "_onChangeOperationId",
10+
"change #delivery-rma-qty input": "_onChangeQty",
11+
"click .o_rma_portal_shipping_card": "_onChangeShippingAddress",
12+
},
13+
14+
/**
15+
* @override
16+
*/
17+
start: function () {
18+
const ids = this.$("[name*='-operation_id']")
19+
.map(function () {
20+
return this.name.replace("-operation_id", "");
21+
})
22+
.get();
23+
this.$submit = $("#form-request-rma button[type='submit']");
24+
this.rows_ids = ids;
25+
// We'll build an object that will ease the form check. It could be further
26+
// extended with additional checks.
27+
this.rows = {};
28+
$.each(ids, (id) => {
29+
this.rows[id] = {
30+
$comment: this.$(`#comment-${id}`),
31+
$comment_input: this.$(`[name='${id}-description']`),
32+
$operation: this.$(`[name='${id}-operation_id']`),
33+
$qty: this.$(`[name='${id}-quantity']`),
34+
};
35+
});
36+
this._checkCanSubmit();
37+
},
38+
/**
39+
* @private
40+
* @param {Object} row: the form row structure
41+
*/
42+
_show_comment: function (row) {
43+
if (row.$comment) {
44+
row.$comment.addClass("show");
45+
if (row.$comment_input) {
46+
row.$comment_input.focus();
47+
}
48+
}
49+
},
50+
/**
51+
* @private
52+
* @param {Object} row: the form row structure
53+
*/
54+
_hide_comment: function (row) {
55+
if (row.$comment) {
56+
row.$comment.removeClass("show");
57+
}
58+
},
59+
/**
60+
* We should be able to submit only when an operation is selected and a
61+
* quantity entered in a row at least.
62+
* @private
63+
*/
64+
_canSubmit: function () {
65+
var can_submit = false;
66+
for (const id of this.rows_ids) {
67+
const row = this.rows[id];
68+
if (
69+
row &&
70+
// Qty greater than 0
71+
row.$qty &&
72+
row.$qty.val() &&
73+
Number(row.$qty.val()) &&
74+
// An operation is defined
75+
row.$operation &&
76+
row.$operation.val()
77+
) {
78+
can_submit = true;
79+
break;
80+
}
81+
}
82+
return can_submit;
83+
},
84+
/**
85+
* Checked every time we change the quantity or the operation and at start
86+
*
87+
* @private
88+
* @param {Object} row: the form row structure
89+
*/
90+
_checkCanSubmit: function () {
91+
this.$submit.prop("disabled", !this._canSubmit());
92+
},
93+
/**
94+
* @private
95+
* @param {InputEvent} ev
96+
*/
97+
_onChangeOperationId: function (ev) {
98+
// Toggle comment on or off if an operation is requested
99+
const id = ev.currentTarget.name.replace("-operation_id", "");
100+
var row = this.rows[id];
101+
if (row && row.$operation && row.$operation.val()) {
102+
this._show_comment(row);
103+
} else {
104+
this._hide_comment(row);
105+
}
106+
this._checkCanSubmit();
107+
},
108+
/**
109+
* @private
110+
*/
111+
_onChangeQty: function () {
112+
this._checkCanSubmit();
113+
},
114+
_onChangeShippingAddress: function (ev) {
115+
const $address_container = $(ev.currentTarget.parentElement);
116+
$address_container.find("input").removeAttr("checked");
117+
$address_container
118+
.find(".o_rma_portal_shipping_card")
119+
.removeClass("bg-primary")
120+
.removeClass("text-primary");
121+
$(ev.currentTarget).find("input").attr("checked", "checked");
122+
$(ev.currentTarget).addClass("bg-primary").addClass("text-primary");
123+
},
124+
});

0 commit comments

Comments
 (0)