diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index ecf007beb..ac2128ede 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -84,7 +84,7 @@ class PropertyLeaseContract(models.Model):
rent = fields.Float(string="租金", help='第一笔合同的应收')
total_contract_receivables = fields.Float(string="合同总应收")
tax_rate = fields.Many2one('yuthon.tariff.setting', string="税率")
- use_address = fields.Char(string="使用地址", default=lambda self: self.name)
+ use_address = fields.Char(string="使用地址")
not_tax_amount = fields.Float(string="不含税价")
tax = fields.Float(string="税金")
is_water = fields.Boolean(string="是否有水费")
@@ -460,6 +460,7 @@ class PropertyLeaseContract(models.Model):
if record.address_id:
lease_name.append(record.address_id.name)
rec.name = ','.join(lease_name)
+ rec.use_address = ','.join(lease_name)
property_id = self.env['yuthon.property'].search([('id', '=', record.address_id.id)])
if property_id.energy_meter_ids:
rec.is_electricity = True
@@ -512,6 +513,12 @@ class PropertyLeaseContract(models.Model):
}))
record.lease_ids = management_list
+ def action_use_address(self):
+ contract_ids = self.env["property.lease.contract"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for record in contract_ids:
+ record.use_address = record.name
+
class PropertyLeaseContractLine(models.Model):
_name = 'property.lease.contract.line'
_description = '物业列表明细行'
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index 92a72ef99..464e44195 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -266,4 +266,11 @@
code
action = model.trigger_lease_ids()
+
+ 更新使用地址
+
+
+ code
+ action = model.action_use_address()
+
\ No newline at end of file