[IMP] web: Allow hide/show stroke in signature

In the sign application, it appeared that when using the default signature
in a signature SignItem that was higher the stroke at the bottom was doubbled.

This was caused by the fact that the bottom stroke is always added to the
template and that the default signature image had it already.

In order to solve this, we have added a setting 'show-stroke' that allows
controlling the stroke presence in the signature.

Task Id 2216067
Closes #48529

Related odoo/enterprise#9538

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Laurent Stukkens (LTU)
2020-05-08 07:56:09 +00:00
parent 7c00503008
commit 68584351e4
4 changed files with 16 additions and 4 deletions
@@ -736,6 +736,7 @@ function jSignatureClass(parent, options, instanceExtensions) {
,'color' : '#000'
,'background-color': '#fff'
,'decor-color': '#eee'
,'show-stroke': true
,'lineWidth' : 0
,'minFatFingerCompensation' : -10
,'showUndoButton': false
@@ -977,7 +978,7 @@ jSignatureClass.prototype.resetCanvas = function(data, dontClear){
ctx.lineCap = ctx.lineJoin = "round";
// signature line
if (null != settings['decor-color']) {
if (null != settings['decor-color'] && settings['show-stroke']) {
ctx.strokeStyle = settings['decor-color'];
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
@@ -250,7 +250,8 @@ var NameAndSignature = Widget.extend({
.empty()
.jSignature({
'decor-color': '#D1D0CE',
'background-color': '#FFF',
'background-color': 'rgba(255,255,255,0)',
'show-stroke': false,
'color': this.fontColor,
'lineWidth': 2,
'width': width,
@@ -47,3 +47,11 @@
cursor: pointer;
}
}
.o_signature_stroke {
position: absolute;
border-top: #D1D0CE solid 2px;
bottom: 16%;
width: 72%;
left: 14%;
}
@@ -49,7 +49,7 @@
border, but we remove the padding from the body, so the canvas
will overflow on the corners without this rule.
-->
<div class="o_web_sign_signature_group card mt-3" style="overflow: hidden;">
<div class="o_web_sign_signature_group bg-white card mt-3" style="overflow: hidden;">
<div class="card-header">
<div class="row no-gutters">
<div class="col-auto">
@@ -83,7 +83,9 @@
</div>
</div>
<div class="o_web_sign_signature card-body p-0"/>
<div class="o_signature_stroke position-absolute"/>
<div class="o_web_sign_signature p-0 bg-transparent position-relative"/>
<div t-attf-class="o_web_sign_load_invalid card-footer d-none">
<div class="alert alert-danger mb-0" role="alert">