traingsprodukte und nutzungsprodukte als Liste
This commit is contained in:
parent
a8aa4798b1
commit
9bfea2b586
|
|
@ -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
|
||||
/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
|
||||
|
|
@ -179,20 +179,24 @@ 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.')
|
||||
]
|
||||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
|
@ -9,8 +9,8 @@
|
|||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="area_id" widget="many2one_color"/>
|
||||
<field name="machine_product" widget="many2one"/>
|
||||
<field name="product_names"/>
|
||||
<field name="training_names"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
|
@ -27,20 +27,26 @@
|
|||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="area_id"/>
|
||||
<field name="machine_product"/>
|
||||
<field name="description"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
|
||||
<!-- Neue Einweisungsprodukte-Tabelle -->
|
||||
<!-- Neue -->
|
||||
<notebook>
|
||||
<page string="Einweisungsprodukte">
|
||||
<page string="Nutzungsprodukte">
|
||||
<field name="product_ids" context="{'default_machine_id': active_id}">
|
||||
<tree editable="bottom">
|
||||
<field name="product_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Einweisungsprodukte">
|
||||
<field name="training_ids" context="{'default_machine_id': active_id}">
|
||||
<tree editable="bottom">
|
||||
<field name="training_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -68,4 +68,34 @@
|
|||
<field name="view_id" ref="base.view_partner_tree"/>
|
||||
</record>
|
||||
-->
|
||||
<record id="ows_userList_inherit" model="ir.ui.view">
|
||||
<field name="name">res.partner.ows.tree</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='vat']" position="after">
|
||||
<field name="create_date" optional="show"/>
|
||||
<field name="security_briefing" optional="show"/>
|
||||
<field name="security_id" optional="show"/>
|
||||
<field name="rfid_card" optional="show"/>
|
||||
<field name="category_id" widget="many2many_tags"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='vat']" position="replace">
|
||||
<field name="vat" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='email']" position="replace">
|
||||
<field name="email" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='phone']" position="replace">
|
||||
<field name="phone" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='state_id']" position="replace">
|
||||
<field name="state_id" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='country_id']" position="replace">
|
||||
<field name="country_id" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user