diff --git a/__manifest__.py b/__manifest__.py index c3ad55a..c63f254 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -15,8 +15,8 @@ 'views/partner_machine_access_html.xml', 'views/assets.xml', 'data/data.xml', - #'data/product_category.csv', - #'data/product_product.csv', + 'data/data_product_and_categories.xml', + ], 'qweb': [ 'static/src/xml/ows_briefing_details.xml', diff --git a/data/data_product_and_categories.xml b/data/data_product_and_categories.xml new file mode 100644 index 0000000..dd3566c --- /dev/null +++ b/data/data_product_and_categories.xml @@ -0,0 +1,177 @@ + + + + Einweisungen + + + Maschinennutzung + + + 3D Druck (30 Minuten) + + 0.25 + True + + + + Bandschleifer (1 Minute) + + 0.1 + True + + + + Bandsäge (1 Minute) + + 0.1 + True + + + + CNC Fräse (1 Minute) + + 0.1 + True + + + + CNC Sicherheitseinweisung + + 25.0 + True + + + + Drehbank (1 Minute) + + 0.1 + True + + + + Einweisung 3D Drucker Delta + + 15.0 + True + + + + Einweisung 3D Drucker Prusa + + 20.0 + True + + + + Einweisung Bandsäge + + 15.0 + True + + + + Einweisung Drehbank + + 20.0 + True + + + + Einweisung FKS + + 20.0 + True + + + + Einweisung Hobel + + 15.0 + True + + + + Einweisung Laser + + 15.0 + True + + + + Einweisung Metallfräse + + 20.0 + True + + + + Einweisung Schweißgerät + + 10.0 + True + + + + Einweisung in maschinelle Holzverbindungen + + 15.0 + True + + + + Formatkreissäge (1 Minute) + + 0.1 + True + + + + Fräse - Deckel (1 Minute) + + 0.1 + True + + + + Hobel (1 Minute) + + 0.1 + True + + + + Laser (Aktivminute) + + 0.7000000000000001 + True + + + + Sandstrahlbox (1 Minute) + + 0.2 + True + + + + Schweißgerät (1 Minute) + + 0.2 + True + + + + Schweißkabine (eigenes Schweißgerät - 1 Minute) + + 0.1 + True + + + + Sonstige Dienstleistungen/Nutzung + + 1.0 + True + + + \ No newline at end of file diff --git a/data/export.sh b/data/export.sh index c07b1f2..24f8fbd 100755 --- a/data/export.sh +++ b/data/export.sh @@ -1,2 +1,2 @@ -/opt/odoo/odoo/odoo-bin shell -d hobbyhimmel < /home/odoo/custom_addons/open_workshop/data/export_products.py -/opt/odoo/odoo/odoo-bin shell -d hobbyhimmel < /home/odoo/custom_addons/open_workshop/data/export_categories.py +/opt/odoo/odoo/odoo-bin shell -d hobbyhimmel < /home/odoo/custom_addons/open_workshop/data/export_products_and_categories.py + diff --git a/data/export_products_and_categories.py b/data/export_products_and_categories.py new file mode 100644 index 0000000..c8d9514 --- /dev/null +++ b/data/export_products_and_categories.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +import xml.etree.ElementTree as ET + +def xml_safe_id(name): + return name.lower().replace(' ', '_').replace('/', '_').replace('(', '').replace(')', '').replace('-', '_') + +def export_categories_and_products(env): + root = ET.Element("odoo") + + # Export Kategorien + categories = env['product.category'].search([ + ('name', 'in', ['Einweisungen', 'Maschinennutzung']) + ]) + for cat in categories: + record = ET.SubElement(root, "record", { + "id": f"cat_{xml_safe_id(cat.name)}", + "model": "product.category" + }) + ET.SubElement(record, "field", name="name").text = cat.name + if cat.parent_id: + ET.SubElement(record, "field", name="parent_id", attrib={"ref": f"cat_{xml_safe_id(cat.parent_id.name)}"}) + + # Export Produkte + products = env['product.product'].search([ + ('categ_id.name', 'in', ['Einweisungen', 'Maschinennutzung']) + ]) + for product in products: + record = ET.SubElement(root, "record", { + "id": f"prod_{xml_safe_id(product.name)}", + "model": "product.product" + }) + ET.SubElement(record, "field", name="name").text = product.name or '' + ET.SubElement(record, "field", name="default_code").text = product.default_code or '' + ET.SubElement(record, "field", name="list_price").text = str(product.list_price or 0.0) + ET.SubElement(record, "field", name="available_in_pos").text = "True" + if product.categ_id: + ET.SubElement(record, "field", name="categ_id", attrib={"ref": f"cat_{xml_safe_id(product.categ_id.name)}"}) + + tree = ET.ElementTree(root) + tree.write("data_product_and_categories.xml", encoding="utf-8", xml_declaration=True) + print("✅ XML export saved to data_product_and_categories.xml") + +# Automatischer Start in odoo-bin shell +if 'env' in globals(): + export_categories_and_products(env) diff --git a/models/ows_models.py b/models/ows_models.py index 385c74d..e4a51af 100644 --- a/models/ows_models.py +++ b/models/ows_models.py @@ -122,8 +122,8 @@ class ResPartner(models.Model): } self.env['ows.user'].create(vals) migrated += 1 + _logger.info(f"Erzeuge ows.user für Partner {partner.id} ({partner.name}) mit Werten: {vals}") - _logger = self.env['ir.logging'] _logger.info(f"[OWS Migration] ✅ Migriert: {migrated}, ❌ Übersprungen: {skipped}") return { diff --git a/static/src/js/debug.js b/static/src/js/debug.js index 1eec09f..20085e1 100644 --- a/static/src/js/debug.js +++ b/static/src/js/debug.js @@ -3,30 +3,16 @@ odoo.define('open_workshop.debug', function (require) { var models = require('point_of_sale.models'); var screens = require('point_of_sale.screens'); - // Laden der zusätzlichen Felder - models.load_fields('res.partner', [ - 'vvow_document_id' - ]); // 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.vvow_document_id) { - console.log('vvow_document_id:', partner.vvow_document_id); + if (partner.ows_user_id.document_id) { + console.log('partner.ows_user_id.document_id:', partner.ows_user_id.document_id); } }, }); - /* Erweiterung von ClientDetailsWidget, um die Kundendetails anzuzeigen - screens.ClientDetailsWidget.include({ - show: function() { - this._super(); - console.log('ClientDetailsWidget Showing client details:', this.partner); - if (this.partner && this.partner.vvow_document_id) { - console.log('vvow_document_id:', this.partner.vvow_document_id); - } - } - });*/ }); diff --git a/static/src/js/partner_access_popup.js b/static/src/js/partner_access_popup.js index 38a252a..997b3eb 100644 --- a/static/src/js/partner_access_popup.js +++ b/static/src/js/partner_access_popup.js @@ -3,12 +3,8 @@ odoo.define('open_workshop.models', function (require) { var models = require('point_of_sale.models'); var field_utils = require('web.field_utils'); - models.load_fields('res.partner', 'vvow_birthday'); - models.load_fields('res.partner', 'vvow_security_briefing'); - models.load_fields('res.partner', 'vvow_security_id'); - models.load_fields('res.partner', 'vvow_rfid_card'); models.load_fields('res.partner', 'create_date'); - models.load_fields('res.partner', 'vvow_document_id'); + }); odoo.define('open_workshop.partner_access_popup', function (require) { diff --git a/static/src/xml/ows_briefing_details.xml b/static/src/xml/ows_briefing_details.xml index 24a4235..871df3f 100644 --- a/static/src/xml/ows_briefing_details.xml +++ b/static/src/xml/ows_briefing_details.xml @@ -29,12 +29,12 @@
Geburtstag - + - + - + N/A
@@ -62,23 +62,23 @@
Haftungs. - + Ja - + Nein, bitte überprüfen! Id: - + - + - + Kein ID vorhanden diff --git a/static/src/xml/ows_briefing_details_edit.xml b/static/src/xml/ows_briefing_details_edit.xml index 228cdcb..ba2c4a3 100644 --- a/static/src/xml/ows_briefing_details_edit.xml +++ b/static/src/xml/ows_briefing_details_edit.xml @@ -37,7 +37,7 @@
Geburtstag - +
Pricelist @@ -53,8 +53,8 @@
Haftungsauschschluß
diff --git a/views/assets.xml b/views/assets.xml index 7be1067..8f59d57 100644 --- a/views/assets.xml +++ b/views/assets.xml @@ -2,7 +2,6 @@