字段调整
This commit is contained in:
@@ -25,6 +25,22 @@ class PropertyConfirm(models.Model):
|
||||
type_stamp_ids = fields.Many2many('seals.type.setting', string='用章类型', domain="['&', ('start_date', '<=', context_today()), '|', ('end_date', '=', False), ('end_date', '>=', context_today())]")
|
||||
documents_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
lease_ids = fields.One2many('property.lease.contract.line', 'confirm_id', string="物业列表")
|
||||
# 面积:下方物业明细行「可租面积(property_area)」的合计
|
||||
property_area = fields.Float(string="面积", compute="_compute_property_area", digits=(16, 4))
|
||||
# 租期年限(整型)
|
||||
lease_term_years = fields.Integer(string="租期年限")
|
||||
# 免租天数(整型)
|
||||
rent_free_days = fields.Integer(string="免租天数")
|
||||
# 每几年递增(整型,与递增百分比组合成「每 __ 年递增 __ %」)
|
||||
increments_few_years = fields.Integer(string="每几年递增")
|
||||
# 递增百分比
|
||||
annual_increase_percentage = fields.Float(string="递增百分比", digits=(6, 2))
|
||||
|
||||
@api.depends('lease_ids', 'lease_ids.property_area')
|
||||
def _compute_property_area(self):
|
||||
# 汇总每条成交确认单下所有物业明细行的可租面积
|
||||
for rec in self:
|
||||
rec.property_area = sum(rec.lease_ids.mapped('property_area'))
|
||||
|
||||
def _get_default_name_title(self):
|
||||
return '成交确认书'
|
||||
|
||||
@@ -84,6 +84,29 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 面积/租期年限/免租天数/递增(与表单字段位置、命名对齐) -->
|
||||
<tr>
|
||||
<!-- 面积:下方物业明细行可租面积之和 -->
|
||||
<td class="header-cell"><strong>面积</strong></td>
|
||||
<td><span t-esc="doc.property_area"/></td>
|
||||
<!-- 租期年限(整型,单位年) -->
|
||||
<td class="header-cell"><strong>租期年限</strong></td>
|
||||
<td><span t-esc="doc.lease_term_years"/><t t-if="doc.lease_term_years"> 年</t></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- 免租天数(整型,单位天) -->
|
||||
<td class="header-cell"><strong>免租天数</strong></td>
|
||||
<td><span t-esc="doc.rent_free_days"/><t t-if="doc.rent_free_days"> 天</t></td>
|
||||
<!-- 每 __ 年递增 __ %:与表单单行组合一致 -->
|
||||
<td class="header-cell"><strong>每几年递增</strong></td>
|
||||
<td>
|
||||
<t t-if="doc.increments_few_years or doc.annual_increase_percentage">
|
||||
每 <span t-esc="doc.increments_few_years"/> 年递增 <span t-esc="doc.annual_increase_percentage"/> %
|
||||
</t>
|
||||
<t t-else="">—</t>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 物业列表明细 -->
|
||||
<t t-if="doc.lease_ids">
|
||||
<tr>
|
||||
|
||||
@@ -1,4 +1,32 @@
|
||||
.list_width{
|
||||
width: 300px !important;
|
||||
max-width: 300px !important;
|
||||
}
|
||||
}
|
||||
|
||||
// 成交确认:「每 __ 年递增 __ %」紧凑单行组合
|
||||
// 根因:可编辑表单里 .o_form_editable .o_row > .o_field_widget 会被设成 flex:1 1 auto;width:0,把字段拉满整行,
|
||||
// 导致末尾的「%」被顶到最右边。故不用 o_row,改用自定义类 + 固定窄宽度。
|
||||
.o_confirm_increase_combo {
|
||||
display: flex !important; // 单行 flex 排列
|
||||
flex-flow: row nowrap !important; // 禁止换行
|
||||
align-items: center !important; // 垂直居中
|
||||
gap: 6px !important; // 元素间距
|
||||
|
||||
> * {
|
||||
flex: 0 0 auto !important; // 所有子项均不拉伸
|
||||
}
|
||||
|
||||
> span {
|
||||
white-space: nowrap !important; // 文字不换行
|
||||
}
|
||||
|
||||
// 两个数字字段固定窄宽度
|
||||
.o_field_widget {
|
||||
width: 90px !important;
|
||||
}
|
||||
|
||||
// 输入框填满字段宽度
|
||||
.o_field_widget input {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,23 @@
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
</group>
|
||||
<!-- 面积/租期年限/免租天数 + 递增条件:放在附件(documents_ids)字段之后 -->
|
||||
<group col="4">
|
||||
<!-- 面积:下方物业明细行可租面积之和(compute,非 stored) -->
|
||||
<field name="property_area" string="面积"/>
|
||||
<!-- 租期年限(整型) -->
|
||||
<field name="lease_term_years"/>
|
||||
<!-- 免租天数(整型) -->
|
||||
<field name="rent_free_days"/>
|
||||
</group>
|
||||
<!-- 每 __ 年递增 __ %:单行组合展示(自定义类,避免 o_row 把字段拉满整行) -->
|
||||
<div class="o_confirm_increase_combo">
|
||||
<span>每</span>
|
||||
<field name="increments_few_years" nolabel="1"/>
|
||||
<span>年递增</span>
|
||||
<field name="annual_increase_percentage" nolabel="1"/>
|
||||
<span>%</span>
|
||||
</div>
|
||||
<notebook>
|
||||
<page string="物业列表">
|
||||
<button name="choose_property_button" string="添加物业" type="object" class="btn-primary"/>
|
||||
|
||||
Reference in New Issue
Block a user