合并企业版代码(未测试,先提交到测试分支)
This commit is contained in:
29
quality/static/src/tablet_image_field/tablet_image_field.js
Normal file
29
quality/static/src/tablet_image_field/tablet_image_field.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { ImageField } from '@web/views/fields/image/image_field';
|
||||
|
||||
const { Component } = owl;
|
||||
|
||||
class ImagePreviewDialog extends Component {}
|
||||
ImagePreviewDialog.components = { Dialog };
|
||||
ImagePreviewDialog.template = "quality.ImagePreviewDialog";
|
||||
|
||||
export class TabletImageField extends ImageField {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.dialog = useService("dialog");
|
||||
}
|
||||
|
||||
openModal() {
|
||||
this.dialog.add(ImagePreviewDialog, {
|
||||
src: this.getUrl(this.props.name),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TabletImageField.template = "quality.TabletImageField";
|
||||
|
||||
registry.category("fields").add("tablet_image", TabletImageField);
|
||||
@@ -0,0 +1,24 @@
|
||||
.workorder_picture, .quality_picture {
|
||||
margin: 5px 0;
|
||||
|
||||
.o_field_tablet_image {
|
||||
img {
|
||||
height: 80px;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
button {
|
||||
@include o-hover-opacity(0.6, 0.9);
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: #00A09D !important;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
#picture_button {
|
||||
margin-top: 0;
|
||||
@include o-position-absolute($top: 33%, $left: 106%);
|
||||
}
|
||||
}
|
||||
26
quality/static/src/tablet_image_field/tablet_image_field.xml
Normal file
26
quality/static/src/tablet_image_field/tablet_image_field.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="quality.TabletImageField" t-inherit="web.ImageField" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//button[hasclass('o_select_file_button')]" position="replace">
|
||||
<div class="position-absolute start-100 bottom-100 ms-2" id="picture_button">
|
||||
<button class="btn btn-primary o_select_file_button" barcode_trigger="measure">Take a Picture</button>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//img" position="attributes">
|
||||
<attribute name="t-on-click">openModal</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t t-name="quality.ImagePreviewDialog" owl="1">
|
||||
<Dialog title="'Preview'" size="'lg'">
|
||||
<div class="o_viewer_img_wrapper">
|
||||
<div class="o_viewer_zoomer">
|
||||
<img alt="Viewer" class="o_viewer_img" t-att-src="props.src"/>
|
||||
</div>
|
||||
</div>
|
||||
<t t-set-slot="footer">
|
||||
<button class="btn btn-primary" t-on-click.stop="props.close">Close</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user