[FIX] web: display signatures in signature fields
**Before this commit**
Since [1], the signature field only display placeholder
signatures when it has a value.
**Explanation**
The commit [1] removes the props "value" from the standard field props.
The signature field missed an adaptation.
**After this commit**
The issue is fixed and a test has been written.
[1] 688986f888
opw-3335655
closes odoo/odoo#123463
X-original-commit: 4edc5e3326cc92e9adf4f2512af1e85382108bb3
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
This commit is contained in:
@@ -43,9 +43,9 @@ export class SignatureField extends Component {
|
||||
}
|
||||
|
||||
get getUrl() {
|
||||
const { name, previewImage, record, value } = this.props;
|
||||
if (this.state.isValid && value) {
|
||||
if (isBinarySize(value)) {
|
||||
const { name, previewImage, record } = this.props;
|
||||
if (this.state.isValid && this.value) {
|
||||
if (isBinarySize(this.value)) {
|
||||
return url("/web/image", {
|
||||
model: record.resModel,
|
||||
id: record.resId,
|
||||
@@ -63,9 +63,9 @@ export class SignatureField extends Component {
|
||||
}
|
||||
|
||||
get sizeStyle() {
|
||||
let { width, height, value } = this.props;
|
||||
let { width, height } = this.props;
|
||||
|
||||
if (!value) {
|
||||
if (!this.value) {
|
||||
if (width && height) {
|
||||
width = Math.min(width, this.displaySignatureRatio * height);
|
||||
height = width / this.displaySignatureRatio;
|
||||
@@ -86,6 +86,10 @@ export class SignatureField extends Component {
|
||||
return style;
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this.props.record.data[this.props.name];
|
||||
}
|
||||
|
||||
onClickSignature() {
|
||||
if (!this.props.readonly) {
|
||||
const nameAndSignatureProps = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="web.SignatureField" owl="1">
|
||||
<t t-if="props.record.data[props.name]">
|
||||
<t t-if="value">
|
||||
<img class="o_signature img img-fluid"
|
||||
alt="Binary file"
|
||||
t-att-src="getUrl"
|
||||
|
||||
Reference in New Issue
Block a user