forked from Techsystech/web
[11.0][MIG] web_widget_image_webcam: code migration
parent
0b16e67a74
commit
a8b6512fc3
|
@ -39,7 +39,7 @@ Credits
|
||||||
Contributors
|
Contributors
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Siddharth Bhalgami <siddharth.bhalgami@techreceptives.com>
|
* Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
* Kaushal Prajapati <kbprajapati@live.com>
|
* Kaushal Prajapati <kbprajapati@live.com>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Copyright 2019 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
|
|
||||||
|
from . import models
|
|
@ -1,12 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
# Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@techreceptives.com>
|
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
{
|
{
|
||||||
"name": "Web Widget - Image WebCam",
|
"name": "Web Widget - Image WebCam",
|
||||||
"summary": "Allows to take image with WebCam",
|
"summary": "Allows to take image with WebCam",
|
||||||
"version": "10.0.1.0.0",
|
"version": "11.0.1.0.0",
|
||||||
"category": "web",
|
"category": "web",
|
||||||
"website": "https://www.techreceptives.com",
|
"website": "https://github.com/OCA/web",
|
||||||
"author": "Tech Receptives, "
|
"author": "Tech Receptives, "
|
||||||
"Odoo Community Association (OCA), "
|
"Odoo Community Association (OCA), "
|
||||||
"Kaushal Prajapati",
|
"Kaushal Prajapati",
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Copyright 2019 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
|
|
||||||
|
from . import ir_config_parameter
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Copyright 2019 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
|
|
||||||
|
from odoo.models import api, Model
|
||||||
|
|
||||||
|
|
||||||
|
class IrConfigParameter(Model):
|
||||||
|
_inherit = "ir.config_parameter"
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def get_webcam_flash_fallback_mode_config(self):
|
||||||
|
return self.sudo().get_param(
|
||||||
|
'web_widget_image_webcam.flash_fallback_mode',
|
||||||
|
default=False)
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@techreceptives.com>
|
Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
*/
|
*/
|
||||||
.o_form_view.o_form_editable .o_form_field_image .o_form_image_controls
|
.o_form_view.o_form_editable .o_form_field_image .o_form_image_controls
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@techreceptives.com>
|
Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
*/
|
*/
|
||||||
odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var core = require('web.core');
|
var core = require('web.core');
|
||||||
var Model = require('web.Model');
|
var rpc = require('web.rpc');
|
||||||
var Dialog = require('web.Dialog');
|
var Dialog = require('web.Dialog');
|
||||||
|
var FieldBinaryImage = require('web.basic_fields').FieldBinaryImage;
|
||||||
|
|
||||||
var _t = core._t;
|
var _t = core._t;
|
||||||
var QWeb = core.qweb;
|
var QWeb = core.qweb;
|
||||||
|
|
||||||
core.form_widget_registry.get("image").include({
|
FieldBinaryImage.include({
|
||||||
|
|
||||||
render_value: function () {
|
_render: function () {
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
var self = this,
|
var self = this,
|
||||||
|
@ -35,10 +36,10 @@ odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
||||||
swfURL: '/web_widget_image_webcam/static/src/js/webcam.swf',
|
swfURL: '/web_widget_image_webcam/static/src/js/webcam.swf',
|
||||||
});
|
});
|
||||||
|
|
||||||
self.$el.find('.o_form_binary_file_web_cam').removeClass('col-md-offset-5');
|
rpc.query({
|
||||||
|
model: 'ir.config_parameter',
|
||||||
new Model('ir.config_parameter').call('get_param', ['web_widget_image_webcam.flash_fallback_mode', false]).
|
method: 'get_webcam_flash_fallback_mode_config',
|
||||||
then(function(default_flash_fallback_mode) {
|
}).then(function(default_flash_fallback_mode) {
|
||||||
if (default_flash_fallback_mode == 1) {
|
if (default_flash_fallback_mode == 1) {
|
||||||
Webcam.set({
|
Webcam.set({
|
||||||
/*
|
/*
|
||||||
|
@ -52,7 +53,7 @@ odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
||||||
|
|
||||||
self.$el.find('.o_form_binary_file_web_cam').off().on('click', function(){
|
self.$el.find('.o_form_binary_file_web_cam').off().on('click', function(){
|
||||||
// Init Webcam
|
// Init Webcam
|
||||||
new Dialog(self, {
|
var dialog = new Dialog(self, {
|
||||||
size: 'large',
|
size: 'large',
|
||||||
dialogClass: 'o_act_window',
|
dialogClass: 'o_act_window',
|
||||||
title: _t("WebCam Booth"),
|
title: _t("WebCam Booth"),
|
||||||
|
@ -66,9 +67,11 @@ odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
||||||
// Display Snap besides Live WebCam Preview
|
// Display Snap besides Live WebCam Preview
|
||||||
WebCamDialog.find("#webcam_result").html('<img src="'+img_data+'"/>');
|
WebCamDialog.find("#webcam_result").html('<img src="'+img_data+'"/>');
|
||||||
});
|
});
|
||||||
|
if (Webcam.live) {
|
||||||
// Remove "disabled" attr from "Save & Close" button
|
// Remove "disabled" attr from "Save & Close" button
|
||||||
$('.save_close_btn').removeAttr('disabled');
|
$('.save_close_btn').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: _t("Save & Close"), classes: 'btn-primary save_close_btn', close: true,
|
text: _t("Save & Close"), classes: 'btn-primary save_close_btn', close: true,
|
||||||
|
@ -100,6 +103,7 @@ odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
||||||
]
|
]
|
||||||
}).open();
|
}).open();
|
||||||
|
|
||||||
|
dialog.opened().then(function() {
|
||||||
Webcam.attach('#live_webcam');
|
Webcam.attach('#live_webcam');
|
||||||
|
|
||||||
// At time of Init "Save & Close" button is disabled
|
// At time of Init "Save & Close" button is disabled
|
||||||
|
@ -108,6 +112,7 @@ odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
|
||||||
// Placeholder Image in the div "webcam_result"
|
// Placeholder Image in the div "webcam_result"
|
||||||
WebCamDialog.find("#webcam_result").html('<img src="/web_widget_image_webcam/static/src/img/webcam_placeholder.png"/>');
|
WebCamDialog.find("#webcam_result").html('<img src="/web_widget_image_webcam/static/src/img/webcam_placeholder.png"/>');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@techreceptives.com>
|
<!-- Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||||
<template id="template" xml:space="preserve">
|
<template id="template" xml:space="preserve">
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@techreceptives.com>
|
<!-- Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="assets_backend" inherit_id="web.assets_backend">
|
<template id="assets_backend" inherit_id="web.assets_backend">
|
||||||
|
|
Loading…
Reference in New Issue