diff --git a/yuthon_property/static/src/scss/property_scss.scss b/yuthon_property/static/src/scss/property_scss.scss index d8b62360d..90a9f2a2f 100644 --- a/yuthon_property/static/src/scss/property_scss.scss +++ b/yuthon_property/static/src/scss/property_scss.scss @@ -49,4 +49,8 @@ white-space: nowrap !important; word-break: normal !important; word-wrap: normal !important; -} \ No newline at end of file +} + +/* 批量开票导出弹窗的应收类型字段已由 many2many_checkboxes 改为 many2many_tags(标签+下拉搜索), + 不再需要为「勾选框横向排列」写样式:Odoo 自带的 o_field_tags 本身就是 d-inline-flex flex-wrap, + 标签会横向排列并自动换行。原 .o_m2m_inline 相关规则已全部移除。 */ diff --git a/yuthon_property/wizard/batch_invoice_export_wizard.py b/yuthon_property/wizard/batch_invoice_export_wizard.py index d268a6b40..ed92aead8 100644 --- a/yuthon_property/wizard/batch_invoice_export_wizard.py +++ b/yuthon_property/wizard/batch_invoice_export_wizard.py @@ -14,9 +14,8 @@ class BatchInvoiceExportWizard(models.TransientModel): _name = 'batch.invoice.export.wizard' _description = '批量开票导出向导' - include_rent = fields.Boolean(string='租金', default=True) - include_deposit = fields.Boolean(string='押金', default=False) - include_penalty = fields.Boolean(string='违约金', default=False) + # 应收类型:指向 yuthon.management.type 的多对多,弹窗里直接罗列该字段的全部可选值供勾选 + management_type_ids = fields.Many2many('yuthon.management.type', string='应收类型') active_ids = fields.Char(string='选中记录IDs') @@ -28,19 +27,12 @@ class BatchInvoiceExportWizard(models.TransientModel): receivable_records = self.env['property.accounts.receivable'].browse(active_ids) - # 按应收类型过滤 - allowed = [] - if self.include_rent: - allowed.append('租金') - if self.include_deposit: - allowed.append('押金') - if self.include_penalty: - allowed.append('违约金') - if allowed: + # 按勾选的应收类型过滤:勾选集合非空时,只保留 management_type_id 落在集合内的记录 + if self.management_type_ids: receivable_records = receivable_records.filtered( - lambda r: r.management_type_id and r.management_type_id.name in allowed + lambda r: r.management_type_id in self.management_type_ids ) - # allowed 为空时不过滤,导出全部 + # 未勾选任何应收类型时不过滤,导出全部(沿用原有逻辑) if not receivable_records: raise UserError('过滤后没有符合条件的记录,请检查所选记录的应收类型') diff --git a/yuthon_property/wizard/batch_invoice_export_wizard_views.xml b/yuthon_property/wizard/batch_invoice_export_wizard_views.xml index 595188096..3029291a9 100644 --- a/yuthon_property/wizard/batch_invoice_export_wizard_views.xml +++ b/yuthon_property/wizard/batch_invoice_export_wizard_views.xml @@ -5,10 +5,11 @@ batch.invoice.export.wizard
- - - - + + + + +