Merge pull request !12902 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-09-22 08:58:19 +00:00
committed by Gitee
3 changed files with 16 additions and 19 deletions
@@ -49,4 +49,8 @@
white-space: nowrap !important; white-space: nowrap !important;
word-break: normal !important; word-break: normal !important;
word-wrap: normal !important; word-wrap: normal !important;
} }
/* 批量开票导出弹窗的应收类型字段已由 many2many_checkboxes 改为 many2many_tags(标签+下拉搜索),
不再需要为「勾选框横向排列」写样式:Odoo 自带的 o_field_tags 本身就是 d-inline-flex flex-wrap,
标签会横向排列并自动换行。原 .o_m2m_inline 相关规则已全部移除。 */
@@ -14,9 +14,8 @@ class BatchInvoiceExportWizard(models.TransientModel):
_name = 'batch.invoice.export.wizard' _name = 'batch.invoice.export.wizard'
_description = '批量开票导出向导' _description = '批量开票导出向导'
include_rent = fields.Boolean(string='租金', default=True) # 应收类型:指向 yuthon.management.type 的多对多,弹窗里直接罗列该字段的全部可选值供勾选
include_deposit = fields.Boolean(string='押金', default=False) management_type_ids = fields.Many2many('yuthon.management.type', string='应收类型')
include_penalty = fields.Boolean(string='违约金', default=False)
active_ids = fields.Char(string='选中记录IDs') active_ids = fields.Char(string='选中记录IDs')
@@ -28,19 +27,12 @@ class BatchInvoiceExportWizard(models.TransientModel):
receivable_records = self.env['property.accounts.receivable'].browse(active_ids) receivable_records = self.env['property.accounts.receivable'].browse(active_ids)
# 按应收类型过滤 # 按勾选的应收类型过滤:勾选集合非空时,只保留 management_type_id 落在集合内的记录
allowed = [] if self.management_type_ids:
if self.include_rent:
allowed.append('租金')
if self.include_deposit:
allowed.append('押金')
if self.include_penalty:
allowed.append('违约金')
if allowed:
receivable_records = receivable_records.filtered( 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: if not receivable_records:
raise UserError('过滤后没有符合条件的记录,请检查所选记录的应收类型') raise UserError('过滤后没有符合条件的记录,请检查所选记录的应收类型')
@@ -5,10 +5,11 @@
<field name="model">batch.invoice.export.wizard</field> <field name="model">batch.invoice.export.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="批量开票导出"> <form string="批量开票导出">
<group string="应收类型"> <!-- 应收类型:用 many2many_tags(标签 + 下拉搜索选择),写法与 attendance_iot 模块「拷贝考勤机记录」弹窗里的「同步的考勤机」完全一致 -->
<field name="include_rent"/> <!-- 不带 nolabel,让字段自带标签「应收类型」占左侧标签列,避免字段被压进窄列(此前 nolabel 导致中文逐字竖排) -->
<field name="include_deposit"/> <!-- no_create:只能从已有应收类型里挑,禁止在下拉里顺手新建类型记录(原勾选框也只能选、不能新建) -->
<field name="include_penalty"/> <group>
<field name="management_type_ids" widget="many2many_tags" options="{'no_create': True}"/>
</group> </group>
<footer> <footer>
<button name="action_export" string="导出" type="object" class="btn-primary"/> <button name="action_export" string="导出" type="object" class="btn-primary"/>