Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -48,6 +48,38 @@ class PropertyTenantInformation(models.Model):
|
||||
if bank_id.name == False and bank_id.user == False and bank_id.bank == False:
|
||||
bank_id.unlink()
|
||||
|
||||
def batch_delete_invalid_invoicing_lines(self):
|
||||
"""批量删除没有生效日期的开票信息明细记录"""
|
||||
# 查找所有生效日期为空的开票信息明细
|
||||
invalid_lines = self.env['invoicing.information.line'].search([
|
||||
('start_date', '=', False)
|
||||
])
|
||||
|
||||
count = len(invalid_lines)
|
||||
if count > 0:
|
||||
invalid_lines.unlink()
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': '删除成功',
|
||||
'message': f'已成功删除 {count} 条没有生效日期的开票信息明细记录',
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': '提示',
|
||||
'message': '没有找到需要删除的记录',
|
||||
'type': 'info',
|
||||
'sticky': False,
|
||||
}
|
||||
}
|
||||
|
||||
@api.depends('invoicing_ids', 'invoicing_ids.start_date', 'invoicing_ids.end_date',
|
||||
'invoicing_ids.scope_business', 'invoicing_ids.invoicing_type',
|
||||
'invoicing_ids.tax_number', 'invoicing_ids.invoicing_begins')
|
||||
|
||||
@@ -94,4 +94,11 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_tenant_wizard()</field>
|
||||
</record>
|
||||
<record id="batch_delete_invalid_invoicing_lines_action" model="ir.actions.server">
|
||||
<field name="name">批量删除无生效日期的开票信息</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_tenant_information"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_tenant_information"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = env['property.tenant.information'].batch_delete_invalid_invoicing_lines()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user