[FIX] stock: add translation in dynamic button contain change

Steps to reproduce the issue:

1)Inventory > Configuration > Settings > Activate "Reception Report"
> Activate "Show reception report"
2)Choose a non english language
3)Sales > Choose SO > Delivery > Allocation
4)Click on the Assign/Unassign equivalent in the new language

Current behavior:
The word in the Assign/Unassign button is in english

Expected behavior:
The word in the Assign/Unassign button is in the new language

Explanation:
When clicked the button starts a function in js that changes the
button text context without translating the new text. We also modify
the text in javascript and the problem is solved.

Issue 2:
The button had fixed size specific to the english language, if a longer
translation in another language was used it was cut leading to make it
unuderstanble in some languages (e.g. german).

opw-2827247

closes odoo/odoo#90705

X-original-commit: 260f433f5600e568db59c82a9c2fc807c1204b5f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Fockedey Martin (mafo) <mafo@odoo.com>
This commit is contained in:
mafo-odoo
2022-05-06 08:42:10 +02:00
parent 5ccdef06a7
commit 3a6bd727bb
3 changed files with 8 additions and 8 deletions
+6
View File
@@ -910,7 +910,10 @@ msgid "As soon as possible"
msgstr ""
#. module: stock
#. openerp-web
#: code:addons/stock/static/src/js/report_stock_reception.js:0
#: model_terms:ir.ui.view,arch_db:stock.report_reception_body
#, python-format
msgid "Assign"
msgstr ""
@@ -8033,7 +8036,10 @@ msgid "USPS Connector"
msgstr ""
#. module: stock
#. openerp-web
#: code:addons/stock/static/src/js/report_stock_reception.js:0
#: model_terms:ir.ui.view,arch_db:stock.report_reception_body
#, python-format
msgid "Unassign"
msgstr ""
@@ -4,6 +4,7 @@ import clientAction from 'report.client_action';
import core from 'web.core';
const qweb = core.qweb;
const _t = core._t;
const ReceptionReport = clientAction.extend({
/**
@@ -70,7 +71,7 @@ const ReceptionReport = clientAction.extend({
_switchButton: function (button) {
button.innerText = button.innerText.includes('Unassign') ? "Assign" : "Unassign";
button.innerText = button.innerText.includes(_t("Unassign")) ? _t("Assign") : _t("Unassign");
button.name = button.name === 'assign_link' ? 'unassign_link' : 'assign_link';
button.classList.toggle("o_report_reception_assign");
button.classList.toggle("o_report_reception_unassign");
@@ -16,13 +16,6 @@
&:hover:not([disabled]) {
background-color: darken($o-brand-primary, 10%);
}
&.o_report_reception_assign,
&.o_report_reception_unassign {
width: 78px;
}
& .o_print_label_text {
width: 73px;
}
}
}
& .badge {