@ -0,0 +1,49 @@ |
|||
.. image:: https://img.shields.io/badge/licenses-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Image Capture Widget |
|||
======================= |
|||
This module allow to Capture images from the webcam . |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V16) Megha K, |
|||
(V17) Anjhana A K, |
|||
(V18) Ammu Raj |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import wizard |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Image Capture Widget', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Extra Tools', |
|||
'summary': """This module allows to capture the users image from the |
|||
webcam.""", |
|||
'description': """This module is used to add Image Capture Widget for Image |
|||
Field. We can capture the image from the webcam and upload into the binary |
|||
field.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['sale_management', 'contacts'], |
|||
'data': ['security/ir.model.access.csv'], |
|||
'assets': { |
|||
'web.assets_backend': [ |
|||
'/image_capture_upload_widget/static/src/scss/image_capture.scss', |
|||
'/image_capture_upload_widget/static/src/js/image_capture.js', |
|||
'/image_capture_upload_widget/static/src/xml/image_capture_templates.xml', |
|||
], |
|||
}, |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <image_capture_upload_widget> |
|||
|
|||
#### 19.03.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Image Capture Widget |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 757 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 254 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 225 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 709 KiB |
After Width: | Height: | Size: 38 KiB |
@ -0,0 +1,277 @@ |
|||
/** @odoo-module **/ |
|||
|
|||
import { isMobileOS } from "@web/core/browser/feature_detection"; |
|||
import { _t } from "@web/core/l10n/translation"; |
|||
import { registry } from "@web/core/registry"; |
|||
import { useService } from "@web/core/utils/hooks"; |
|||
import { url } from "@web/core/utils/urls"; |
|||
import { isBinarySize } from "@web/core/utils/binary"; |
|||
import { rpc } from "@web/core/network/rpc"; |
|||
import { FileUploader } from "@web/views/fields/file_handler"; |
|||
import { standardFieldProps } from "@web/views/fields/standard_field_props"; |
|||
import { Component, useState, onWillUpdateProps,useRef} from "@odoo/owl"; |
|||
const { DateTime } = luxon; |
|||
export const fileTypeMagicWordMap = { |
|||
"/": "jpg", |
|||
R: "gif", |
|||
i: "png", |
|||
P: "svg+xml", |
|||
}; |
|||
|
|||
const placeholder = "/web/static/img/placeholder.png"; |
|||
export function imageCacheKey(value) { |
|||
if (value instanceof DateTime) { |
|||
return value.ts; |
|||
} |
|||
return ""; |
|||
} |
|||
class imageCapture extends Component { |
|||
static template = "CaptureImage"; |
|||
static components = { |
|||
FileUploader,}; |
|||
static props = { |
|||
...standardFieldProps, |
|||
enableZoom: { type: Boolean, optional: true }, |
|||
zoomDelay: { type: Number, optional: true }, |
|||
previewImage: { type: String, optional: true }, |
|||
acceptedFileExtensions: { type: String, optional: true }, |
|||
width: { type: Number, optional: true }, |
|||
height: { type: Number, optional: true }, |
|||
reload: { type: Boolean, optional: true }, |
|||
}; |
|||
static defaultProps = { |
|||
acceptedFileExtensions: "image/*", |
|||
reload: true, |
|||
}; |
|||
setup() { |
|||
this.notification = useService("notification"); |
|||
this.orm = useService("orm") |
|||
this.isMobile = isMobileOS(); |
|||
this.state = useState({ |
|||
isValid: true, |
|||
stream: null, |
|||
}); |
|||
this.player = useRef("player"); |
|||
this.capture = useRef("capture"); |
|||
this.camera = useRef("camera"); |
|||
this.save_image = useRef("save_image"); |
|||
this.rawCacheKey = this.props.record.data.write_date; |
|||
onWillUpdateProps((nextProps) => { |
|||
const { record } = this.props; |
|||
const { record: nextRecord } = nextProps; |
|||
if (record.resId !== nextRecord.resId || nextRecord.mode === "readonly") { |
|||
this.rawCacheKey = nextRecord.data.write_date; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
get sizeStyle() { |
|||
// For getting image style details
|
|||
let style = ""; |
|||
if (this.props.width) { |
|||
style += `max-width: ${this.props.width}px;`; |
|||
} |
|||
if (this.props.height) { |
|||
style += `max-height: ${this.props.height}px;`; |
|||
} |
|||
return style; |
|||
} |
|||
get hasTooltip() { |
|||
return ( |
|||
this.props.enableZoom && this.props.readonly && this.props.record.data[this.props.name] |
|||
); |
|||
} |
|||
getUrl(previewFieldName) { |
|||
// getting the details and url of the image
|
|||
if (!this.props.reload && this.lastURL) { |
|||
return this.lastURL; |
|||
} |
|||
if (this.state.isValid && this.props.record.data[this.props.name]) { |
|||
if (isBinarySize(this.props.record.data[this.props.name])) { |
|||
if (!this.rawCacheKey) { |
|||
this.rawCacheKey = this.props.record.data.write_date; |
|||
} |
|||
this.lastURL = url("/web/image", { |
|||
model: this.props.record.resModel, |
|||
id: this.props.record.resId, |
|||
field: previewFieldName, |
|||
unique: imageCacheKey(this.rawCacheKey), |
|||
}); |
|||
} else { |
|||
// Use magic-word technique for detecting image type
|
|||
const magic = |
|||
fileTypeMagicWordMap[this.props.record.data[this.props.name][0]] || "png"; |
|||
this.lastURL = `data:image/${magic};base64,${ |
|||
this.props.record.data[this.props.name] |
|||
}`;
|
|||
} |
|||
return this.lastURL; |
|||
} |
|||
return placeholder; |
|||
} |
|||
onFileRemove() { |
|||
// removing the images
|
|||
this.state.isValid = true; |
|||
this.props.record.update({ [this.props.name]: false }); |
|||
} |
|||
async onFileUploaded(info) { |
|||
// Upload the images
|
|||
this.state.isValid = true; |
|||
this.rawCacheKey = null; |
|||
this.props.record.update({ [this.props.name]: info.data }); |
|||
} |
|||
onFileCaptureImage() { |
|||
// Open a window for open the image and capture it
|
|||
var field = this.props.name; |
|||
var id = this.props.record.data.id; |
|||
var model = this.props.record.resModel; |
|||
} |
|||
|
|||
async checkCameraPermission() { |
|||
try { |
|||
const permissionStatus = await navigator.permissions.query({ name: 'camera' }); |
|||
console.log("Camera permission state:", permissionStatus.state); |
|||
if (permissionStatus.state === "granted") { |
|||
return true; // Permission is granted
|
|||
} else if (permissionStatus.state === "prompt") { |
|||
console.warn("Camera permission needs to be granted by the user."); |
|||
} else if (permissionStatus.state === "denied") { |
|||
console.error("Camera access denied. Please enable it in browser settings."); |
|||
} |
|||
return false; |
|||
} catch (error) { |
|||
console.error("Error checking camera permission:", error); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
async OnClickOpenCamera() { |
|||
// opening the camera for capture the image
|
|||
try { |
|||
const hasPermission = await this.checkCameraPermission(); |
|||
if (!hasPermission) { |
|||
alert("Camera access denied. Please enable it in browser settings."); |
|||
return; |
|||
} |
|||
this.player.el.classList.remove('d-none'); |
|||
this.capture.el.classList.remove('d-none'); |
|||
this.camera.el.classList.add('d-none'); |
|||
this.state.stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: false }); |
|||
this.player.el.srcObject = this.state.stream; |
|||
} catch (error) { |
|||
console.error("Error accessing camera:", error); |
|||
alert("Error accessing camera: " + error.message); |
|||
} |
|||
} |
|||
stopTracksOnMediaStream(mediaStream) { |
|||
for (const track of mediaStream.getTracks()) { |
|||
track.stop(); |
|||
} |
|||
} |
|||
async OnClickCaptureImage() { |
|||
// Capture the image from webcam and close the webcam
|
|||
var context = snapshot.getContext('2d'); |
|||
var canvas = document.getElementById('snapshot') |
|||
var image = document.getElementById('image'); |
|||
this.save_image.el.classList.remove('d-none'); |
|||
context.drawImage(player, 0, 0, 320, 240); |
|||
image.value = context.canvas.toDataURL(); |
|||
canvas.classList.remove('d-none'); |
|||
this.url = context.canvas.toDataURL(); |
|||
} |
|||
async OnClickSaveImage(){ |
|||
// Saving the image to that field
|
|||
var self = this |
|||
await rpc('/web/dataset/call_kw', { |
|||
model: 'image.capture', |
|||
method: 'action_save_image', |
|||
args: [[], this.url], |
|||
kwargs: {} |
|||
}).then(function(results){ |
|||
self.props.value = results |
|||
var data = { |
|||
data: results, |
|||
name : "ImageFile.png", |
|||
objectUrl: null, |
|||
size : 106252, |
|||
type: "image/png" |
|||
} |
|||
self.onFileUploaded(data) |
|||
}) |
|||
this.player.el.classList.add('d-none'); |
|||
var snapshot = document.getElementById('snapshot') |
|||
snapshot.classList.add('d-none'); |
|||
this.capture.el.classList.add('d-none'); |
|||
this.save_image.el.classList.add('d-none'); |
|||
this.camera.el.classList.remove('d-none'); |
|||
this.player.el.srcObject = null; |
|||
if (!this.state.stream) { |
|||
return; |
|||
} |
|||
this.stopTracksOnMediaStream(this.state.stream); |
|||
this.state.stream = null; |
|||
} |
|||
onLoadFailed() { |
|||
this.state.isValid = false; |
|||
this.notification.add(this.env._t("Could not display the selected image"), { |
|||
type: "danger", |
|||
}); |
|||
} |
|||
} |
|||
export const ImageCapture = { |
|||
component: imageCapture, |
|||
displayName: _t("Image"), |
|||
supportedOptions: [ |
|||
{ |
|||
label: _t("Reload"), |
|||
name: "reload", |
|||
type: "boolean", |
|||
default: true, |
|||
}, |
|||
{ |
|||
label: _t("Enable zoom"), |
|||
name: "zoom", |
|||
type: "boolean", |
|||
}, |
|||
{ |
|||
label: _t("Zoom delay"), |
|||
name: "zoom_delay", |
|||
type: "number", |
|||
help: _t("Delay the apparition of the zoomed image with a value in milliseconds"), |
|||
}, |
|||
{ |
|||
label: _t("Accepted file extensions"), |
|||
name: "accepted_file_extensions", |
|||
type: "string", |
|||
}, |
|||
{ |
|||
label: _t("Size"), |
|||
name: "size", |
|||
type: "selection", |
|||
choices: [ |
|||
{ label: _t("Small"), value: "[0,90]" }, |
|||
{ label: _t("Medium"), value: "[0,180]" }, |
|||
{ label: _t("Large"), value: "[0,270]" }, |
|||
], |
|||
}, |
|||
{ |
|||
label: _t("Preview image"), |
|||
name: "preview_image", |
|||
type: "field", |
|||
availableTypes: ["binary"], |
|||
}, |
|||
], |
|||
supportedTypes: ["binary"], |
|||
fieldDependencies: [{ name: "write_date", type: "datetime" }], |
|||
isEmpty: () => false, |
|||
extractProps: ({ attrs, options }) => ({ |
|||
enableZoom: options.zoom, |
|||
zoomDelay: options.zoom_delay, |
|||
previewImage: options.preview_image, |
|||
acceptedFileExtensions: options.accepted_file_extensions, |
|||
width: options.size && Boolean(options.size[0]) ? options.size[0] : attrs.width, |
|||
height: options.size && Boolean(options.size[1]) ? options.size[1] : attrs.height, |
|||
reload: "reload" in options ? Boolean(options.reload) : true, |
|||
}), |
|||
}; |
|||
registry.category("fields").add("capture_image", ImageCapture); |
@ -0,0 +1,17 @@ |
|||
.o_field_image { |
|||
background-color: var(--ImageField-background-color, transparent); |
|||
|
|||
button { |
|||
transition: opacity ease 400ms; |
|||
width: 26px; |
|||
height: 26px; |
|||
} |
|||
|
|||
.o_mobile_controls { |
|||
button { |
|||
width: 30px; |
|||
height: 30px; |
|||
padding: 6px !important; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,65 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!--Template for the widget--> |
|||
<templates xml:space="preserve"> |
|||
<t t-name="CaptureImage"> |
|||
<div class="d-inline-block position-relative opacity-trigger-hover"> |
|||
<div t-attf-class="position-absolute d-flex justify-content-between w-100 bottom-0 opacity-0 opacity-100-hover {{isMobile ? 'o_mobile_controls' : ''}}" |
|||
aria-atomic="true" t-att-style="sizeStyle"> |
|||
<t t-if="!props.readonly"> |
|||
<FileUploader |
|||
acceptedFileExtensions="props.acceptedFileExtensions" |
|||
onUploaded.bind="onFileUploaded"> |
|||
<t t-set-slot="toggler"> |
|||
<button |
|||
class="o_select_file_button btn btn-light border-0 rounded-circle m-1 p-1" |
|||
data-tooltip="Edit" |
|||
aria-label="Edit"> |
|||
<i class="fa fa-pencil fa-fw"/> |
|||
</button> |
|||
</t> |
|||
<button |
|||
t-if="props.value and state.isValid" |
|||
class="o_clear_file_button btn btn-light border-0 rounded-circle m-1 p-1" |
|||
data-tooltip="Clear" |
|||
aria-label="Clear" |
|||
t-on-click="onFileRemove"> |
|||
<i class="fa fa-trash-o fa-fw"/> |
|||
</button> |
|||
</FileUploader> |
|||
<button |
|||
class="o_upload_image_button btn btn-light border-0 rounded-circle m-1 p-1" |
|||
data-tooltip="Upload" |
|||
aria-label="Upload" id="camera" t-ref="camera" |
|||
t-on-click="OnClickOpenCamera"> |
|||
<i class="fa fa-camera fa-fw"/> |
|||
</button> |
|||
<div id="capture" class="btn btn-primary d-none" |
|||
t-on-click="OnClickCaptureImage" t-ref="capture">Capture |
|||
</div> |
|||
<div id="save_image" class="btn btn-primary d-none" |
|||
t-on-click="OnClickSaveImage" t-ref="save_image">Save Image |
|||
</div> |
|||
</t> |
|||
</div> |
|||
<t t-if="props.name"> |
|||
<img |
|||
class="img img-fluid w-100" |
|||
alt="Binary file" |
|||
t-att-src="getUrl(props.previewImage or props.name)" |
|||
t-att-name="props.name" |
|||
t-att-height="props.height" |
|||
t-att-width="props.width" |
|||
t-att-style="sizeStyle" |
|||
t-on-error.stop="onLoadFailed" |
|||
t-att-data-tooltip-template="hasTooltip and tooltipAttributes.template" |
|||
t-att-data-tooltip-info="hasTooltip and tooltipAttributes.info" |
|||
t-att-data-tooltip-delay="hasTooltip and props.zoomDelay"/> |
|||
</t> |
|||
<video id="player" controls="true" class="d-none " t-ref="player" |
|||
autoplay="true" style="width: 320px;padding: 20px;"/> |
|||
<canvas class="d-none" id="snapshot" width="320" |
|||
height="240" style="width: 320px;padding: 20px;"/> |
|||
<input type="hidden" name="image" id="image"/> |
|||
</div> |
|||
</t> |
|||
</templates> |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import image_capture |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import models |
|||
|
|||
|
|||
class ImageCapture(models.TransientModel): |
|||
""" A model for capturing images """ |
|||
_name = 'image.capture' |
|||
_description = 'Image Capture' |
|||
|
|||
def action_save_image(self, url): |
|||
""" |
|||
Saving the images to corresponding models |
|||
:param url: Image details. |
|||
""" |
|||
image = url.split(',') |
|||
return image[1] |