标签:record color sum lock ica else ons stat parent
<page string="Detail"> <field name="asset_equipment_detail_ids" options="{‘no_edit_no_open‘:1}" context="{‘detail_data‘: asset_equipment_detail_ids}" attrs="{‘readonly‘:[(‘state‘,‘!=‘,‘created‘)]}"> <tree editable="bottom" create="1"> <field name="asset_id" options="{‘no_create‘:True}" context="{‘more_domain‘: True, ‘field_ids‘: parent.asset_equipment_detail_ids, ‘model‘: ‘kthrp.asset.equipment.receive.return.application.detail‘, ‘head_company‘: parent.company_id}"/> <field name="receive_time"/> <field name="return_time"/> <field name="duration_time" options="{‘readonly_save‘:1}" sum="Total Duration Time"/> <field name="note"/> </tree> </field> </page>
@api.model def get_domain(self): domain = [] if self.env.context.get(‘more_domain‘, False): field_ids = self.env.context.get(‘field_ids‘, []) # m2o重复选择限制 if field_ids: records = [] model = self.env[self.env.context.get(‘model‘)] for selected_line in field_ids: if selected_line[2]: # 缓存数据 asset_id = selected_line[2].get(‘asset_id‘) records.append(asset_id) else: # 保存数据 asset_id = model.browse(selected_line[1]).asset_id.id records.append(asset_id) domain += [(‘id‘, ‘not in‘, tuple(set(records)))]
标签:record color sum lock ica else ons stat parent
原文地址:https://www.cnblogs.com/pywjh/p/12238189.html