@@ -10,7 +10,7 @@
|
||||
<group>
|
||||
<field name="lease_contract_id" invisible="1"/>
|
||||
<field name="contract_sort_name" invisible="1"/>
|
||||
<field name="property_ids" widget="many2many_tags" context="{'search_view_ref': 'yuthon_property.yuthon_property_search'}" options="{'no_create': True}" domain="[('id', 'not in', property_ids2), ('asset_type_id.name', '=', contract_sort_name)]"/>
|
||||
<field name="property_ids" widget="many2many_tags" context="{'search_view_ref': 'yuthon_property.yuthon_property_search'}" options="{'no_create': True}" domain="[('id', 'not in', property_ids2), ('property_type', '=', property_type)]"/>
|
||||
<field name="property_ids2" widget="many2many_tags" invisible="1"/>
|
||||
</group>
|
||||
<group/>
|
||||
|
||||
@@ -5,6 +5,7 @@ class ChoosePropertyWizard(models.Model):
|
||||
_name = 'choose.property.wizard'
|
||||
|
||||
lease_contract_id = fields.Many2one('property.lease.contract', string="合同")
|
||||
property_type = fields.Selection(related='lease_contract_id.property_type', string="资产类型")
|
||||
property_ids2 = fields.Many2many(
|
||||
'yuthon.property',
|
||||
'choose_property_wizard_property_ids2_rel',
|
||||
@@ -17,30 +18,6 @@ class ChoosePropertyWizard(models.Model):
|
||||
string="物业信息",
|
||||
)
|
||||
|
||||
contract_sort_name = fields.Char(
|
||||
string="合同类型名称",
|
||||
compute='_compute_contract_sort_name',
|
||||
store=True
|
||||
)
|
||||
|
||||
@api.depends('lease_contract_id.contract_sort')
|
||||
def _compute_contract_sort_name(self):
|
||||
type_mapping = {
|
||||
'property': '物业',
|
||||
'guanggao': '广告位',
|
||||
'guanzi': '管子间',
|
||||
'room': '机房',
|
||||
'base_station': '基站'
|
||||
}
|
||||
for rec in self:
|
||||
if rec.lease_contract_id and rec.lease_contract_id.contract_sort:
|
||||
rec.contract_sort_name = type_mapping.get(
|
||||
rec.lease_contract_id.contract_sort,
|
||||
''
|
||||
)
|
||||
else:
|
||||
rec.contract_sort_name = ''
|
||||
|
||||
def confirm(self):
|
||||
rec = self.lease_contract_id
|
||||
lease_name = []
|
||||
|
||||
Reference in New Issue
Block a user