ows_machine_sidebar.xml is messy

This commit is contained in:
gitea 2025-04-16 18:18:31 +00:00
parent 93468530af
commit a159b88691
10 changed files with 109 additions and 136 deletions

View File

@ -26,12 +26,13 @@
'installable': True,
'assets': {
'point_of_sale.assets': [
'static/src/js/partner_access_popup.js',
'static/src/js/machine_access_sidebar.js',
'static/src/css/pos.css',
#'static/src/js/debug.js',
],
},
'post_init_hook': 'run_migration',
'description': """
Diese App erstellt Maschinenfreigaben basierend auf POS-Einweisungsprodukten.
Die App ist für den Einsatz in der Odoo-Version 13.0 konzipiert.
""",
}

View File

@ -82,7 +82,7 @@ class ResPartner(models.Model):
)
machine_access_html = fields.Html(
string="Maschinenfreigaben",
string="Maschinenfreigabe",
compute="_compute_machine_access_html",
sanitize=False
)

View File

@ -368,6 +368,7 @@ td {
.pos .new-order-button{
text-align: center;
width : 100%;
height: 48px;
background : #d3d3d3;
/* overflow: auto; */
}
@ -377,7 +378,7 @@ td {
display: inline-block;
box-sizing: border-box;
-moz-box-sizing: border-box;
height: 30px;
height: 48px;
padding-left: 6px;
margin: 2px;
background: #8b8b8b;
@ -396,6 +397,15 @@ td {
margin-left: 0px;
}
.pos .orders .order-button {
display: flex;
justify-content: flex-start; /* falls nötig */
flex-direction: row-reverse;
align-items: center;
gap: 0.5em;
}
.pos .order-button.selected{
font-weight: 900;
background: #EEEEEE;
@ -460,6 +470,7 @@ td {
}
.pos .orders {
width: 98%;
position: absolute;
vertical-align: top;
margin-left: 0px;
@ -1687,31 +1698,13 @@ td {
background: rgb(227, 246, 237);
}
.pos .clientlist-screen .client-details-grid {
.pos .clientlist-screen {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0px;
}
.pos .clientlist-screen .client-details{
padding: 16px;
border-bottom: solid 5px rgb(110,200,155);
}
.pos .clientlist-screen .client-details-error{
padding: 16px;
border-bottom: solid 5px rgb(110,200,155);
background: rgb(178, 34, 34);
}
/* .pos .clientlist-screen .client-details-vvow_briefing{
color: rgb(128, 255, 0);
} */
.pos .clientlist-screen .client-details-vvow_briefing_error{
color: rgb(255, 0, 0);
}
.pos .clientlist-screen .client-details-vvow_sec_briefing_error{
color: rgb(255, 0, 0);
font-size: xx-large;
}
.pos .clientlist-screen .client-picture{
height: 64px;
width: 64px;
@ -2557,6 +2550,8 @@ td {
z-index: 10;
}
/* Sidebar für Einweisungen*/
.pos .machine-access-sidebar {
position: absolute;
top: 48px; /* unter der Topbar */
@ -2573,10 +2568,15 @@ td {
.pos .machine-access-sidebar .access-content {
position: relative;
top: 45px; /* unter der Topbar */
top: 0px; /* unter der Topbar */
background : #eeeeee;
}
.pos .machine-access-sidebar .client-details-label {
font-size: 18px;
line-height: 48px;
}
.pos .machine-access-sidebar h5 {
margin-top: 1em;
margin-bottom: 0.5em;
@ -2589,3 +2589,23 @@ td {
.pos .machine-access-sidebar li {
margin-bottom: 0.3em;
}
.pos .clientlist-screen .client-details{
padding: 16px;
border-bottom: solid 5px rgb(110,200,155);
}
.pos .clientlist-screen .client-details-error{
padding: 16px;
border-bottom: solid 5px rgb(110,200,155);
background: rgb(178, 34, 34);
}
/* .pos .clientlist-screen .client-details-vvow_briefing{
color: rgb(128, 255, 0);
} */
.pos .clientlist-screen .client-details-vvow_briefing_error{
color: rgb(255, 0, 0);
}
.pos .clientlist-screen .client-details-vvow_sec_briefing_error{
color: rgb(255, 0, 0);
font-size: xx-large;
}

View File

@ -1,18 +0,0 @@
odoo.define('open_workshop.debug', function (require) {
"use strict";
var models = require('point_of_sale.models');
var screens = require('point_of_sale.screens');
// Erweiterung von ClientListScreenWidget, um die Kundendetails anzuzeigen
screens.ClientListScreenWidget.include({
display_client_details: function(partner, clickpos) {
this._super(partner, clickpos);
console.log('ClientListScreenWidget Partner Daten:', partner);
if (partner.ows_user_id.document_id) {
console.log('partner.ows_user_id.document_id:', partner.ows_user_id.document_id);
}
},
});
});

View File

@ -1,7 +1,7 @@
/* This file is based on the original code from the OrderWidget in Odoo Point of Sale module (screen.js).
* It has been modified to create a sidebar that displays machine access information for the selected customer.*/
odoo.define('machine_access_sidebar', function (require) {
odoo.define('open_workshop.machine_access_sidebar', function (require) {
"use strict";
var rpc = require('web.rpc');
@ -106,3 +106,18 @@ odoo.define('machine_access_sidebar', function (require) {
}
});
});
odoo.define('open_workshop.models', function (require) {
"use strict";
var models = require('point_of_sale.models');
var field_utils = require('web.field_utils');
models.load_fields('res.partner', 'create_date');
models.load_fields('res.partner', 'birthday');
models.load_fields('res.partner', 'security_briefing');
models.load_fields('res.partner', 'security_id');
models.load_fields('res.partner', 'rfid_card');
});

View File

@ -1,49 +0,0 @@
odoo.define('open_workshop.models', function (require) {
"use strict";
var models = require('point_of_sale.models');
var field_utils = require('web.field_utils');
models.load_fields('res.partner', 'create_date');
models.load_fields('res.partner', 'birthday');
models.load_fields('res.partner', 'security_briefing');
models.load_fields('res.partner', 'security_id');
models.load_fields('res.partner', 'rfid_card');
});
/* odoo.define('open_workshop.partner_access_popup', function (require) {
"use strict";
var screens = require('point_of_sale.screens');
var rpc = require('web.rpc');
var core = require('web.core');
var QWeb = core.qweb;
console.log("✅ partner_access_popup.js wurde geladen");
screens.ClientListScreenWidget.include({
display_client_details: function (visibility,partner, clickpos) {
this._super(visibility,partner, clickpos);
var self = this;
var client = this.pos.get_order().get_client();
if (visibility !== 'show' || !partner) {
console.log("⛔ Kein Partner oder nicht im show-Modus");
return;
}
rpc.query({
model: 'ows.machine',
method: 'get_access_list_grouped',
args: [partner.id],
}).then(function (result) {
console.log("✅ Maschinenfreigaben vom Server:", result);
const html = QWeb.render('PartnerMachineAccessList', {
areas: result || [],
});
// self.$('.client-details-right').html(html);
});
},
});
});*/

View File

@ -3,26 +3,51 @@
<t t-name="MachineAccessSidebar" owl="1">
<div class="machine-access-sidebar">
<div class="access-content">
<t t-if="partner">
<t t-foreach="machineAreas" t-as="area" t-key="area.id">
<div class="machine-area">
<h5 t-attf-style="color: #{area.color_hex}"><t t-esc="area.name" /></h5>
</div>
</div>
</t>
<t t-name="PartnerMachineAccessList">
<div class="client-details-grid">
<div class='client-details-header'>
<ul><span class='client-details-label'>Einweisungen</span></ul>
<div class='client-details-area' t-att-style="'border: solid 3px #ffffff; margin: 5px;'">
<ul>
<t t-foreach="area.machines" t-as="machine" t-key="machine.id">
<li>
<span t-esc="machine.name" />
<t t-if="machine.has_access"></t>
<t t-else=""></t>
</li>
<div class='client-detail'>
<span class='detail client-details-vvow_briefing'></span>
<span class='briefinglabel'>Werkstatt</span>
</div>
</ul>
<ul><div class='client-detail'>
<t t-if="!partner.security_briefing"><span class='detail client-details-vvow_briefing_error'></span></t>
<t t-if="partner.security_briefing"><span class='detail client-details-vvow_briefing'></span></t>
<span class='briefinglabel'>Haftungsausschluss</span>
<ul><div class='client-detail'>
<t t-if="!partner.security_briefing"><span class='detail client-details-vvow_sec_briefing_error'>Bitte Prüfen</span></t>
<ul><div class='client-detail'>
<t t-if="partner.security_briefing">
<ul><span class='label'>Id:</span>
<t t-if='partner.security_id'><span class='detail client-details-vvow_security_id'><t t-esc="partner.security_id"/></span></t>
<t t-if='!partner.security_id'><span class='detail client-details-vvow_security_id'>N/A</span></t></ul>
<ul><span class='label'>Erstellt:</span>
<t t-if='partner.create_date'><span class='detail client-details-vvow_security_id'><t t-esc="partner.create_date"/></span></t>
<t t-if='!partner.create_date'><span class='detail client-vvow_birthday'>N/A</span></t></ul></t>
</div></ul>
</div>
</div>
<t t-foreach="areas" t-as="area">
<div class='client-details-area' t-att-style="'border: solid 3px ' + area.color_hex + '; margin: 5px;'">
<ul>
<t t-foreach="area.machines" t-as="machine">
<div class='client-detail'>
<t t-if="!machine.has_access"><span class='detail client-details-vvow_briefing_error'></span></t>
<t t-if="machine.has_access"><span class='detail client-details-vvow_briefing'></span></t>
<span class='briefinglabel'><t t-esc="machine.name" /></span>
</div>
</t>
</ul>
</div>
</t>
</t>
<t t-else="">
<p>Kein Kunde ausgewählt.</p>
</t>
</div>
</div>
</t>
</templates>

View File

@ -1,20 +0,0 @@
<templates id="template" xml:space="preserve">
<t t-name="PartnerMachineAccessList">
<div class="client-details-grid">
<t t-foreach="areas" t-as="area">
<div class='client-details-area' t-att-style="'border: solid 3px ' + area.color_hex + '; margin: 5px;'">
<ul>
<t t-foreach="area.machines" t-as="machine">
<div class='client-detail'>
<t t-if="!machine.has_access"><span class='detail client-details-vvow_briefing_error'></span></t>
<t t-if="machine.has_access"><span class='detail client-details-vvow_briefing'></span></t>
<span class='briefinglabel'><t t-esc="machine.name" /></span>
</div>
</t>
</ul>
</div>
</t>
</div>
</t>
</templates>

View File

@ -2,9 +2,8 @@
<data>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/open_workshop/static/src/js/partner_access_popup.js"/>
<script type="text/javascript" src="/open_workshop/static/src/js/machine_access_sidebar.js"/>
<template id="machine_access_template" name="Maschinenfreigaben Template" src="/open_workshop/static/src/xml/ows_pos_machine_access_view.xml"/>
<template id="machine_access_template" name="Maschinenfreigaben Template" src="/open_workshop/static/src/xml/ows_machine_sidebar.xml"/>
</xpath>
<xpath expr="//link[@href='/point_of_sale/static/src/css/pos.css']" position="replace">
<link rel="stylesheet" type="text/css" href="/open_workshop/static/src/css/pos.css"/>