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)
|
||||
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
|
||||
def get_origin():
|
||||
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
|
||||
|
@ -66,6 +66,7 @@ class Template(metaclass=PoolMeta):
|
||||
|
||||
#These are measurements required for the equipments, are in this place
|
||||
# for manage of class 'product.template'
|
||||
|
||||
temperature = fields.Float("Temperature")
|
||||
temperature_uom = fields.Many2One('product.uom', 'Temperature UOM',
|
||||
domain=[('category', '=', Id('optical_equipment', "uom_cat_temperature"))])
|
||||
|
@ -2,7 +2,6 @@
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<field name="subscription_history"/>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="location"/>
|
||||
@ -39,4 +38,11 @@
|
||||
<field name="health_register"/>
|
||||
<label name="origin_country"/>
|
||||
<field name="origin_country"/>
|
||||
|
||||
<notebook>
|
||||
<page string="Subscriptions" id="subscriptions_equipment">
|
||||
<field name="subscription_history"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user