product and categories import as xml from hobbyhimmel db
This commit is contained in:
parent
dbfd702a53
commit
a317315bb2
|
|
@ -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',
|
||||
|
|
|
|||
177
data/data_product_and_categories.xml
Normal file
177
data/data_product_and_categories.xml
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<odoo>
|
||||
<record id="cat_einweisungen" model="product.category">
|
||||
<field name="name">Einweisungen</field>
|
||||
</record>
|
||||
<record id="cat_maschinennutzung" model="product.category">
|
||||
<field name="name">Maschinennutzung</field>
|
||||
</record>
|
||||
<record id="prod_3d_druck_30_minuten" model="product.product">
|
||||
<field name="name">3D Druck (30 Minuten)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.25</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_bandschleifer_1_minute" model="product.product">
|
||||
<field name="name">Bandschleifer (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_bandsäge_1_minute" model="product.product">
|
||||
<field name="name">Bandsäge (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_cnc_fräse_1_minute" model="product.product">
|
||||
<field name="name">CNC Fräse (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_cnc_sicherheitseinweisung" model="product.product">
|
||||
<field name="name">CNC Sicherheitseinweisung</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">25.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_drehbank_1_minute" model="product.product">
|
||||
<field name="name">Drehbank (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_3d_drucker_delta" model="product.product">
|
||||
<field name="name">Einweisung 3D Drucker Delta</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">15.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_3d_drucker_prusa" model="product.product">
|
||||
<field name="name">Einweisung 3D Drucker Prusa</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">20.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_bandsäge" model="product.product">
|
||||
<field name="name">Einweisung Bandsäge</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">15.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_drehbank" model="product.product">
|
||||
<field name="name">Einweisung Drehbank</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">20.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_fks" model="product.product">
|
||||
<field name="name">Einweisung FKS</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">20.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_hobel" model="product.product">
|
||||
<field name="name">Einweisung Hobel</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">15.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_laser" model="product.product">
|
||||
<field name="name">Einweisung Laser</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">15.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_metallfräse" model="product.product">
|
||||
<field name="name">Einweisung Metallfräse</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">20.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_schweißgerät" model="product.product">
|
||||
<field name="name">Einweisung Schweißgerät</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">10.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_einweisung_in_maschinelle_holzverbindungen" model="product.product">
|
||||
<field name="name">Einweisung in maschinelle Holzverbindungen</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">15.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_einweisungen" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_formatkreissäge_1_minute" model="product.product">
|
||||
<field name="name">Formatkreissäge (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_fräse___deckel_1_minute" model="product.product">
|
||||
<field name="name">Fräse - Deckel (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_hobel_1_minute" model="product.product">
|
||||
<field name="name">Hobel (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_laser_aktivminute" model="product.product">
|
||||
<field name="name">Laser (Aktivminute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.7000000000000001</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_sandstrahlbox_1_minute" model="product.product">
|
||||
<field name="name">Sandstrahlbox (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.2</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_schweißgerät_1_minute" model="product.product">
|
||||
<field name="name">Schweißgerät (1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.2</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_schweißkabine_eigenes_schweißgerät___1_minute" model="product.product">
|
||||
<field name="name">Schweißkabine (eigenes Schweißgerät - 1 Minute)</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">0.1</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
<record id="prod_sonstige_dienstleistungen_nutzung" model="product.product">
|
||||
<field name="name">Sonstige Dienstleistungen/Nutzung</field>
|
||||
<field name="default_code" />
|
||||
<field name="list_price">1.0</field>
|
||||
<field name="available_in_pos">True</field>
|
||||
<field ref="cat_maschinennutzung" name="categ_id" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
45
data/export_products_and_categories.py
Normal file
45
data/export_products_and_categories.py
Normal file
|
|
@ -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)
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});*/
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@
|
|||
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Geburtstag</span>
|
||||
<t t-if='partner.vvow_birthday'>
|
||||
<t t-if='partner.ows_user_id.birthday'>
|
||||
<span class='detail client-vvow_birthday'>
|
||||
<t t-esc='partner.vvow_birthday' />
|
||||
<t t-esc='partner.ows_user_id.birthday' />
|
||||
</span>
|
||||
</t>
|
||||
<t t-if='!partner.vvow_birthday'>
|
||||
<t t-if='!partner.ows_user_id.birthday'>
|
||||
<span class='detail client-vvow_birthday empty'>N/A</span>
|
||||
</t>
|
||||
</div>
|
||||
|
|
@ -62,23 +62,23 @@
|
|||
</div>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Haftungs.</span>
|
||||
<t t-if='partner.vvow_security_briefing'>
|
||||
<t t-if='partner.ows_user_id.security_briefing'>
|
||||
<span class='detail client-details-vvow_briefing'>
|
||||
Ja
|
||||
</span>
|
||||
</t>
|
||||
<t t-if='!partner.vvow_security_briefing'>
|
||||
<t t-if='!partner.ows_user_id.security_briefing'>
|
||||
<span class='detail client-details-vvow_sec_briefing_error'>
|
||||
Nein, bitte überprüfen!
|
||||
</span>
|
||||
</t>
|
||||
<span class='label'>Id:</span>
|
||||
<t t-if='partner.vvow_security_id'>
|
||||
<t t-if='partner.ows_user_id.security_id'>
|
||||
<span class='detail client-details-vvow_security_id'>
|
||||
<t t-esc="partner.vvow_security_id"/>
|
||||
<t t-esc="partner.ows_user_id.security_id"/>
|
||||
</span>
|
||||
</t>
|
||||
<t t-if='!partner.vvow_security_id'>
|
||||
<t t-if='!partner.ows_user_id.security_id'>
|
||||
<span class='detail client-details-vvow_security_id__error'>
|
||||
Kein ID vorhanden
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Geburtstag</span>
|
||||
<input class='detail client-birthday' name='vvow_birthday' type='date' t-att-value='partner.vvow_birthday || ""'></input>
|
||||
<input class='detail client-birthday' name='birthday' type='date' t-att-value='partner.ows_user_id.birthday || ""'></input>
|
||||
</div>
|
||||
<div t-attf-class='client-detail #{widget.pos.pricelists.length <= 1 ? "oe_hidden" : ""}'>
|
||||
<span class='label'>Pricelist</span>
|
||||
|
|
@ -53,8 +53,8 @@
|
|||
<div class='client-detail'>
|
||||
<span class='label'>Haftungsauschschluß</span>
|
||||
<select class='detail client-vvow_security_briefing-states needsclick' name='vvow_security_briefing'>
|
||||
<option value='true' t-att-selected="partner.vvow_security_briefing ? true : undefined">Ja</option>
|
||||
<option value='' t-att-selected="!partner.vvow_security_briefing ? true: undefined">Nein</option>
|
||||
<option value='true' t-att-selected="partner.ows_user_id.security_briefing ? true : undefined">Ja</option>
|
||||
<option value='' t-att-selected="!partner.ows_user_id.security_briefing ? true: undefined">Nein</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
<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/debug.js"/>
|
||||
<template id="machine_access_template" name="Maschinenfreigaben Template"
|
||||
src="/open_workshop/static/src/xml/partner_access_popup.xml"/>
|
||||
</xpath>
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@
|
|||
<page string="Nutzungsprodukte">
|
||||
<field name="product_ids" context="{'default_machine_id': active_id}">
|
||||
<tree editable="bottom">
|
||||
<field name="product_id"/>
|
||||
<field name="product_id" domain="[('categ_id.name', '=', 'Maschinennutzung')]" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Einweisungsprodukte">
|
||||
<field name="training_ids" context="{'default_machine_id': active_id}">
|
||||
<tree editable="bottom">
|
||||
<field name="training_id"/>
|
||||
<field name="training_id" domain="[('categ_id.name', '=', 'Einweisungen')]" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user