添加功能
This commit is contained in:
@@ -156,6 +156,25 @@ class YuthonProperty(models.Model):
|
||||
for property_id in property_ids:
|
||||
property_id.compute_is_new()
|
||||
|
||||
def update_message(self):
|
||||
property_ids = self.env["yuthon.property"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for property_rec in property_ids:
|
||||
if not property_rec.manage_information_ids:
|
||||
continue
|
||||
date_groups = {}
|
||||
for line in property_rec.manage_information_ids:
|
||||
date_key = line.start_time or 'no_date'
|
||||
if date_key not in date_groups:
|
||||
date_groups[date_key] = []
|
||||
date_groups[date_key].append(line.id)
|
||||
ids_to_unlink = []
|
||||
for date_key, line_ids in date_groups.items():
|
||||
if len(line_ids) > 1:
|
||||
ids_to_unlink.extend(line_ids[1:])
|
||||
if ids_to_unlink:
|
||||
self.env['manage.information.line'].browse(ids_to_unlink).unlink()
|
||||
|
||||
@api.depends('manage_information_ids', 'manage_information_ids.start_time',
|
||||
'manage_information_ids.end_date', 'is_done_split')
|
||||
def compute_is_new(self):
|
||||
|
||||
@@ -476,6 +476,13 @@
|
||||
<field name="binding_model_id" ref="yuthon_property.model_yuthon_property"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.trigger_company_id()</field>
|
||||
</record>
|
||||
<record id="all_data_update_message" model="ir.actions.server">
|
||||
<field name="name">一次性</field>
|
||||
<field name="model_id" ref="yuthon_property.model_yuthon_property"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_yuthon_property"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_message()</field>
|
||||
</record>
|
||||
<record id="all_data_update_revert_change" model="ir.actions.server">
|
||||
<field name="name">还原物业变更信息</field>
|
||||
|
||||
Reference in New Issue
Block a user