@@ -58,6 +58,7 @@
|
||||
<header>
|
||||
<button name="all_meeting_issue" type="object" string="会议安排" class="oe_highlight" groups="yuthon_salary.group_lc_user"/>
|
||||
</header>
|
||||
<field name="code"/>
|
||||
<field name="name" column_invisible="1"/>
|
||||
<field name="is_meeting" column_invisible="1"/>
|
||||
<field name="department_id"/>
|
||||
@@ -92,8 +93,8 @@
|
||||
<!-- <button name="revoke" string="撤销" type="object" class="oe_highlight" invisible="issue_state == 'draft'"/>-->
|
||||
<button name="issue_cancel" string="取消" type="object" class="btn btn-blue"/>
|
||||
<button name="unlink" string="删除" type="object" class="btn btn-blue"/>
|
||||
<button name="correction" string="修正提醒" type="object" class="btn btn-blue" invisible="is_confirm"/>
|
||||
<button name="correction_confirm" string="确认" type="object" class="btn btn-blue" invisible="not is_confirm"/>
|
||||
<button name="correction" string="修正提醒" type="object" class="btn btn-blue" invisible="is_confirm" groups="base.group_system"/>
|
||||
<button name="correction_confirm" string="确认" type="object" class="btn btn-blue" invisible="not is_confirm" groups="base.group_system"/>
|
||||
<button name="approval_details" string="审批详情" type="object" class="btn btn-blue"
|
||||
invisible="not issue_approval_id"/>
|
||||
</tree>
|
||||
|
||||
@@ -2517,11 +2517,26 @@ class PropertyLeaseContractLine(models.Model):
|
||||
address_id = fields.Many2one('yuthon.property', string="物业地址")
|
||||
tax = fields.Float(related='address_id.tax',string="税率")
|
||||
admin_line_id = fields.Many2one(related='address_id.admin_id', string="管理员", store=True)
|
||||
property_area = fields.Float(related='address_id.rent_area', string="可租面积", store=True)
|
||||
property_area = fields.Float(string="可租面积", compute="_compute_property_area")
|
||||
message_standard_id = fields.Many2one(related='address_id.message_standard_id', string="管理费标准", store=True)
|
||||
message_unit = fields.Float(related='message_standard_id.amount', string="管理费单价", store=True)
|
||||
evaluate_unit_price = fields.Float(string="评估单价")
|
||||
|
||||
@api.depends('address_id', 'address_id.manage_information_ids')
|
||||
def _compute_property_area(self):
|
||||
today = fields.Date.today()
|
||||
for line in self:
|
||||
rent_area = 0.0
|
||||
if line.address_id:
|
||||
valid_lines = line.address_id.manage_information_ids.filtered(
|
||||
lambda r:
|
||||
r.start_time <= today
|
||||
and (not r.end_date or r.end_date >= today)
|
||||
)
|
||||
if valid_lines:
|
||||
rent_area = valid_lines[0].rent_area
|
||||
line.property_area = rent_area
|
||||
|
||||
|
||||
def open_record(self):
|
||||
self.ensure_one()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="lease_contract_id" invisible="1"/>
|
||||
<field name="open_rent_id" invisible="1"/>
|
||||
<field name="contract_sort" invisible="1"/>
|
||||
<field name="property_ids" widget="many2many_tags" context="{'search_view_ref': 'yuthon_property.yuthon_property_search'}" options="{'no_create': True}" domain="[('id', 'not in', property_ids2), ('property_type', '=', contract_sort)] if not open_rent_id else [('id', 'not in', property_ids2)]"/>
|
||||
<field name="property_ids" widget="many2many_tags" context="{'search_view_ref': 'yuthon_property.yuthon_property_search'}" options="{'no_create': True}" domain="[('id', 'not in', property_ids2)]"/>
|
||||
<field name="property_ids2" widget="many2many_tags" invisible="1"/>
|
||||
</group>
|
||||
<group/>
|
||||
|
||||
@@ -29,7 +29,12 @@ class SalaryFieldConfig(models.TransientModel):
|
||||
]
|
||||
|
||||
def action_sync(self):
|
||||
config_fields = self.env[self._dynamic_field_config].search([('active', 'in', [True, False])])
|
||||
# 👇 只获取当前选中的配置行
|
||||
record_ids = self.env["salary.field.config"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id'))
|
||||
)
|
||||
config_fields = record_ids.filtered(lambda r: r.active in [True, False])
|
||||
|
||||
model_id = self.env['ir.model'].search([('model', '=', self._dynamic_field_model)])
|
||||
|
||||
if not config_fields or not model_id:
|
||||
@@ -53,18 +58,6 @@ class SalaryFieldConfig(models.TransientModel):
|
||||
for field in new_config_fields:
|
||||
field.symbol = f'{self._dynamic_field_prefix}{field.id}'
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': _('同步字段'),
|
||||
'message': _(f'成功同步 {len(new_fields)} 个薪资自定义字段。'),
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
'next': {'type': 'ir.actions.client', 'tag': 'reload'},
|
||||
},
|
||||
}
|
||||
|
||||
def update_dynamic_fields(updated_config_fields):
|
||||
updated_count = 0
|
||||
for field in updated_config_fields:
|
||||
@@ -80,18 +73,6 @@ class SalaryFieldConfig(models.TransientModel):
|
||||
})
|
||||
updated_count += 1
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': _('同步字段'),
|
||||
'message': _(f'成功更新 {updated_count} 个薪资自定义字段。'),
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
'next': {'type': 'ir.actions.client', 'tag': 'reload'},
|
||||
},
|
||||
}
|
||||
|
||||
exist_dynamic_names = dynamic_fields.mapped('name')
|
||||
exist_ids = [int(e.replace(self._dynamic_field_prefix, '')) for e in exist_dynamic_names if
|
||||
e.replace(self._dynamic_field_prefix, '').isdigit()]
|
||||
@@ -99,19 +80,19 @@ class SalaryFieldConfig(models.TransientModel):
|
||||
# 处理新字段
|
||||
new_config_ids = [field.id for field in config_fields if field.id not in exist_ids]
|
||||
if new_config_ids:
|
||||
create_dynamic_fields(self.search([('id', 'in', new_config_ids)]))
|
||||
create_dynamic_fields(self.browse(new_config_ids))
|
||||
|
||||
# 处理更新字段
|
||||
updated_config_ids = [field.id for field in config_fields if field.id in exist_ids]
|
||||
if updated_config_ids:
|
||||
update_dynamic_fields(self.search([('id', 'in', updated_config_ids)]))
|
||||
update_dynamic_fields(self.browse(updated_config_ids))
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': _('同步完成'),
|
||||
'message': _('所有薪资自定义字段已同步完成!'),
|
||||
'message': _('选中的自定义字段已同步完成!'),
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
'next': {'type': 'ir.actions.client', 'tag': 'reload'},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<header>
|
||||
<button name="action_sync" string="同步字段" type="object" class="btn btn-danger" display="always"/>
|
||||
<button name="action_sync" string="同步字段" type="object" class="btn btn-danger"/>
|
||||
</header>
|
||||
<field name="name" readonly="symbol != False" string="字段名称"/>
|
||||
<field name="field_type" string="字段类型"/>
|
||||
|
||||
@@ -11,6 +11,7 @@ class YuthonWillTask(models.Model):
|
||||
_name = 'yuthon.will.task'
|
||||
_description = '日程'
|
||||
_rec_name = 'name'
|
||||
_order = 'request_hour_from desc'
|
||||
|
||||
time_list = [
|
||||
('0', '0:00'), ('0.25', '0:15'), ('0.5', '0:30'), ('0.75', '0:45'),
|
||||
|
||||
Reference in New Issue
Block a user