Initial commit

This commit is contained in:
Hubert Van De Walle
2026-06-05 16:57:09 +02:00
commit 3b93bbc43f
5 changed files with 141 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
*.pyc
View File
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Mobile Debug",
"version": "1.0.0",
"summary": "Mobile Debug",
"description": "Stuff",
"author": "huvw@odoo.com",
'category': 'Category',
"license": "LGPL-3",
"depends": ["base", "web"],
"data": [
"views/mobile_debug_views.xml",
],
"assets": {
'web.assets_backend': [
"mobile_debug/static/src/index.js"
]
},
"installable": True,
"application": True,
}
+99
View File
@@ -0,0 +1,99 @@
import { registry } from "@web/core/registry";
import mobile from "@web_mobile/js/services/core";
import { Component, useState, useRef } from "@odoo/owl";
class MobileDebug extends Component {
static template = owl.xml`<div class="p-4">
<details>
<summary t-esc="'Mobile methods (' + this.methods.length + ')'">Mobile methods</summary>
<ul t-foreach="this.methods" t-key="method_index" t-as="method">
<li t-esc="method"></li>
</ul>
</details>
<hr/>
<span class="d-flex">
<h2 t-esc="'mode: ' + this.state.mode"/>
<button class="btn btn-primary" t-on-click="() => this.onNext()">next</button>
</span>
<input
type="file"
name="fileInput"
t-att-multiple="this.modes[this.state.mode].multiple ? 'multiple' : false"
t-att-accept="this.modes[this.state.mode].accept"
t-on-change="() => this.onFileChange()"
t-ref="fileInput"
/>
<h2>Files:</h2>
<ul t-foreach="this.state.files" t-key="file_index" t-as="file">
<li t-esc="file.name + ' ' + file.type"></li>
</ul>
<hr/>
</div>`;
setup() {
this.fileInputRef = useRef("fileInput");
this.state = useState({
"mode": "all",
"files": [],
});
this.modes = {
"all": {
accept: "*",
multiple: false,
},
"image": {
accept: "image/*",
multiple: false,
},
"multiple images": {
accept: "image/*",
multiple: true,
},
"pdf": {
accept: "application/pdf",
multiple: false,
}
};
}
onNext() {
this.fileInputRef.el.value = "";
this.state.files = [];
const keys = Object.keys(this.modes);
const idx = keys.indexOf(this.state.mode);
const nextIdx = (idx + 1) % keys.length;
this.state.mode = keys[nextIdx];
}
onFileChange() {
/** @type{HTMLInputElement} **/
const el = this.fileInputRef.el;
if (!el) {
this.state.files = [];
return;
}
const files = el.files;
this.state.files = Array.from(files).map(e => ({
name: e.name,
type: e.type,
}));
}
get methods() {
return [...Object.keys(mobile.methods)];
}
}
registry.category("actions").add("mobile_debug.action_mobile_debug", MobileDebug);
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="mobile_debug.action_mobile_debug" model="ir.actions.client">
<field name="name">Mobile Debug</field>
<field name="tag">mobile_debug.action_mobile_debug</field>
<field name="path">mobile-debug</field>
</record>
<menuitem
name="Mobile Debug"
id="mobile_debug.menu_root"
action="mobile_debug.action_mobile_debug"
web_icon="mail,static/description/icon.png"
groups="base.group_user"
sequence="5"
/>
</data>
</odoo>