field Subscription of 'optical_equipment.equipment' always readonly
This commit is contained in:
parent
7b5cdd61b0
commit
f49769990e
25
equipment.py
25
equipment.py
@ -29,29 +29,10 @@ class OpticalEquipment(ModelSQL, ModelView):
|
|||||||
serial = fields.Char("Serial", size=None)
|
serial = fields.Char("Serial", size=None)
|
||||||
health_register = fields.Char("Health Register", size=None)
|
health_register = fields.Char("Health Register", size=None)
|
||||||
|
|
||||||
subscription_history = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'equipment', 'subscription', "Subscriptions")
|
subscription_history = fields.Many2Many('sale.subscription-optical_equipment.equipment',
|
||||||
|
'equipment','subscription', "Subscriptions",
|
||||||
|
states={'readonly': True})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_origin():
|
def get_origin():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_subscription_history(cls, records, names):
|
|
||||||
pool = Pool()
|
|
||||||
ids = []
|
|
||||||
for record in records:
|
|
||||||
ids.append(record.id)
|
|
||||||
|
|
||||||
Subscriptions = pool.get('sale.subscription-optical_equipment.equipment')
|
|
||||||
subscriptions = Subscriptions.search([("equipment", 'in', ids)])
|
|
||||||
subscriptions_history_id = []
|
|
||||||
DICC = {}
|
|
||||||
|
|
||||||
for subscription in subscriptions:
|
|
||||||
DICC[subscription.equipment.id] = subscription.id
|
|
||||||
|
|
||||||
#raise UserError(str(type(subscriptions_history_id[0])))
|
|
||||||
#raise UserError(str(list(subscriptions_history_id[0])))
|
|
||||||
#raise UserError(str(type(subscriptions_history_id)))
|
|
||||||
|
|
||||||
return DICC
|
|
||||||
|
11
product.py
11
product.py
@ -66,21 +66,22 @@ class Template(metaclass=PoolMeta):
|
|||||||
|
|
||||||
#These are measurements required for the equipments, are in this place
|
#These are measurements required for the equipments, are in this place
|
||||||
# for manage of class 'product.template'
|
# for manage of class 'product.template'
|
||||||
|
|
||||||
temperature = fields.Float("Temperature")
|
temperature = fields.Float("Temperature")
|
||||||
temperature_uom = fields.Many2One('product.uom', 'Temperature UOM',
|
temperature_uom = fields.Many2One('product.uom', 'Temperature UOM',
|
||||||
domain=[('category', '=', Id('optical_equipment', "uom_cat_temperature"))])
|
domain=[('category', '=', Id('optical_equipment', "uom_cat_temperature"))])
|
||||||
frequency = fields.Float("Frequency")
|
frequency = fields.Float("Frequency")
|
||||||
frequency_uom = fields.Many2One('product.uom', "Frequency UOM",
|
frequency_uom = fields.Many2One('product.uom', "Frequency UOM",
|
||||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_frequency'))])
|
domain=[('category', '=', Id('optical_equipment', 'uom_cat_frequency'))])
|
||||||
wet = fields.Float("Wet")
|
wet = fields.Float("Wet")
|
||||||
wet_uom = fields.Many2One('product.uom', "Wet UOM",
|
wet_uom = fields.Many2One('product.uom', "Wet UOM",
|
||||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_relative_humedity'))])
|
domain=[('category', '=', Id('optical_equipment', 'uom_cat_relative_humedity'))])
|
||||||
voltageAC = fields.Float("Voltage AC")
|
voltageAC = fields.Float("Voltage AC")
|
||||||
voltageAC_uom = fields.Many2One('product.uom', "Voltage AC UOM",
|
voltageAC_uom = fields.Many2One('product.uom', "Voltage AC UOM",
|
||||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_electrical_tension'))])
|
domain=[('category', '=', Id('optical_equipment', 'uom_cat_electrical_tension'))])
|
||||||
voltageDC = fields.Float("Voltage DC")
|
voltageDC = fields.Float("Voltage DC")
|
||||||
voltageDC_uom = fields.Many2One('product.uom', "Voltage DC UOM",
|
voltageDC_uom = fields.Many2One('product.uom', "Voltage DC UOM",
|
||||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_electrical_tension'))])
|
domain=[('category', '=', Id('optical_equipment', 'uom_cat_electrical_tension'))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<form>
|
<form>
|
||||||
<field name="subscription_history"/>
|
|
||||||
<label name="company"/>
|
<label name="company"/>
|
||||||
<field name="company"/>
|
<field name="company"/>
|
||||||
<label name="location"/>
|
<label name="location"/>
|
||||||
@ -39,4 +38,11 @@
|
|||||||
<field name="health_register"/>
|
<field name="health_register"/>
|
||||||
<label name="origin_country"/>
|
<label name="origin_country"/>
|
||||||
<field name="origin_country"/>
|
<field name="origin_country"/>
|
||||||
|
|
||||||
|
<notebook>
|
||||||
|
<page string="Subscriptions" id="subscriptions_equipment">
|
||||||
|
<field name="subscription_history"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user