diff --git a/install-odoo.sh b/install-odoo.sh
index 7d1c748..8ec438c 100755
--- a/install-odoo.sh
+++ b/install-odoo.sh
@@ -1 +1 @@
-/opt/odoo/odoo/odoo-bin -d hobbyhimmel13_dev -i pos_time_based_products,wk_coupons,pos_coupons,open_workshop --stop-after-init --load-language=de_DE
\ No newline at end of file
+/opt/odoo/odoo/odoo-bin -d hobbyhimmel13_dev -i base,sale,pos_time_based_products,wk_coupons,pos_coupons,open_workshop --stop-after-init --load-language=de_DE
\ No newline at end of file
diff --git a/models/ows_models.py b/models/ows_models.py
index 05305aa..385c74d 100644
--- a/models/ows_models.py
+++ b/models/ows_models.py
@@ -179,23 +179,27 @@ class OwsMachine(models.Model):
code = fields.Char(required=True, help="Eindeutiger Kurzcode, z.B. 'lasercutter'")
description = fields.Text()
active = fields.Boolean(default=True)
-
area_id = fields.Many2one('ows.machine.area', string='Bereich')
-
- product_ids = fields.One2many('ows.machine.product', 'machine_id', string="Einweisungsprodukte")
- product_names = fields.Char(string="Einweisungsprodukte", compute="_compute_product_names", store=False,)
- machine_product = fields.Many2one('product.product', string="Nutzungsprodukt", domain="[('available_in_pos', '=', True)]")
- #machine_product = fields.Many2one('product.product', string="Nutzungsprodukt")
+ product_ids = fields.One2many('ows.machine.product', 'machine_id', string="Nutzungsprodukte")
+ product_names = fields.Char(string="Nutzungsprodukte Liste", compute="_compute_product_using_names", store=False,)
+ training_ids = fields.One2many('ows.machine.training', 'machine_id', string="Einweisungsprodukte")
+ training_names = fields.Char(string="Einweisungsprodukte Liste", compute="_compute_product_training_names", store=False,)
@api.depends('product_ids.product_id.name')
- def _compute_product_names(self):
+ def _compute_product_using_names(self):
for machine in self:
names = machine.product_ids.mapped('product_id.name')
machine.product_names = ", ".join(names)
+ @api.depends('training_ids.training_id.name')
+ def _compute_product_training_names(self):
+ for machine in self:
+ names = machine.training_ids.mapped('training_id.name')
+ machine.training_names = ", ".join(names)
+
_sql_constraints = [
('code_unique', 'unique(code)', 'Maschinencode muss eindeutig sein.')
- ]
+ ]
def name_get(self):
return [(rec.id, f"{rec.name} ({rec.code})") for rec in self]
@@ -246,9 +250,15 @@ class OwsMachineAccess(models.Model):
class OwsMachineProduct(models.Model):
_name = 'ows.machine.product'
_table = 'ows_machine_product'
- _description = 'OWS: Zurordnung Produkt der Einweisung zur die Maschine'
+ _description = 'OWS: Zurordnung Produkt der Nutzung zur die Maschine'
product_id = fields.Many2one('product.product', required=True, domain=[('available_in_pos', '=', True)], ondelete='cascade')
machine_id = fields.Many2one('ows.machine', required=True, ondelete='cascade')
+class OwsMachineTraining(models.Model):
+ _name = 'ows.machine.training'
+ _table = 'ows_machine_training'
+ _description = 'OWS: Zurordnung Produkt der Einweisung zur die Maschine'
+ training_id = fields.Many2one('product.product', required=True, domain=[('available_in_pos', '=', True)], ondelete='cascade')
+ machine_id = fields.Many2one('ows.machine', required=True, ondelete='cascade')
diff --git a/models/pos_order.py b/models/pos_order.py
index d7153d8..231cc24 100644
--- a/models/pos_order.py
+++ b/models/pos_order.py
@@ -18,7 +18,7 @@ class PosOrder(models.Model):
pos_order_id = super(PosOrder, self)._process_order(order, draft, existing_order)
pos_order = self.browse(pos_order_id)
- training_products = self.env['ows.machine.product'].search([])
+ training_products = self.env['ows.machine.training'].search([])
product_map = {
tp.product_id.product_tmpl_id.id: tp.machine_id.id
for tp in training_products
diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv
index d8bc1dc..227b5fb 100644
--- a/security/ir.model.access.csv
+++ b/security/ir.model.access.csv
@@ -3,4 +3,5 @@ access_ows_machine_access_user,ows.machine.access,model_ows_machine_access,base.
access_ows_machine_user,ows.machine,model_ows_machine,base.group_user,1,1,1,1
access_ows_machine_product_user,ows.machine.product,model_ows_machine_product,base.group_user,1,1,1,1
access_ows_machine_area,ows.machine.area,model_ows_machine_area,base.group_user,1,1,1,1
-access_ows_user,ows.user,model_ows_machine_area,base.group_user,1,1,1,1
+access_ows_user,ows.user,model_ows_user,base.group_user,1,1,1,1
+access_ows_machine_training,ows.machine.training,model_ows_machine_training,base.group_user,1,1,1,1
diff --git a/views/machine_views.xml b/views/machine_views.xml
index 45a9b3e..ee364ab 100644
--- a/views/machine_views.xml
+++ b/views/machine_views.xml
@@ -9,8 +9,8 @@
-
+
@@ -27,20 +27,26 @@
-
-
+
-
+
+
+
+
+
+
+
+
diff --git a/views/res_partner_view.xml b/views/res_partner_view.xml
index 5bb7308..96dd7e2 100644
--- a/views/res_partner_view.xml
+++ b/views/res_partner_view.xml
@@ -28,25 +28,25 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
@@ -68,4 +68,34 @@
-->
+
+ res.partner.ows.tree
+ res.partner
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+