添加功能
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
<filter name="is_start" string="草稿" domain="[('approve_state', '=', 'start')]" />
|
||||
<filter name="is_to_do" string="待办" domain="[('soong_state', '=', 'to_do')]"/>
|
||||
<group expand="0" string="审批分组">
|
||||
<filter string="误餐费" name='group_by_workflow_id' context="{'group_by':'meal'}"/>
|
||||
<filter string="审批类型分组" name='group_by_approvals_group_id' context="{'group_by':'approvals_group_id'}"/>
|
||||
<filter string="状态" name="group_soong_state" context="{'group_by':'soong_state'}"/>
|
||||
</group>
|
||||
@@ -50,6 +51,7 @@
|
||||
<field name="text" optional="hide"/>
|
||||
<field name="documents_ids" optional="hide"/>
|
||||
<group expand="0" string="审批分组">
|
||||
<filter string="误餐费" name='group_by_workflow_id' context="{'group_by':'meal'}"/>
|
||||
<filter string="审批类型分组" name='group_by_approvals_group_id' context="{'group_by':'approvals_group_id'}"/>
|
||||
<filter string="状态" name="group_soong_state" context="{'group_by':'soong_state'}"/>
|
||||
</group>
|
||||
|
||||
@@ -13,17 +13,17 @@ class YuthonShiftApproval(models.Model):
|
||||
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('shift_approval'))
|
||||
resource_id = fields.Many2one('resource.resource', string="申请人", default=lambda self: self.env.user.employee_id.resource_id.id)
|
||||
company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.user.company_id.id)
|
||||
transferees_id = fields.Many2one('resource.resource', string="调班对象", domain="[('id', 'in', resource_ids)]")
|
||||
alternate_id = fields.Many2one('resource.resource', string="替班对象", domain="[('id', 'in', resource_ids)]")
|
||||
alternate_shifts = fields.Selection([('transferees', '调班'), ('alternate', '替班')], string="调替班" , default='transferees')
|
||||
transferees_id = fields.Many2one('resource.resource', string="换班对象", domain="[('id', 'in', resource_ids)]")
|
||||
alternate_id = fields.Many2one('resource.resource', string="顶班对象", domain="[('id', 'in', resource_ids)]")
|
||||
alternate_shifts = fields.Selection([('transferees', '换班'), ('alternate', '顶班')], string="申请类型" , default='transferees')
|
||||
shift_date = fields.Date(string="日期")
|
||||
shift_id = fields.Many2one('planning.slot', string="我的班次1")
|
||||
shift_id = fields.Many2one('planning.slot', string="我的班次")
|
||||
shift_two_date = fields.Date(string="日期")
|
||||
shift_two_id = fields.Many2one('planning.slot', string="我的班次2")
|
||||
shift_two_id = fields.Many2one('planning.slot', string="我的班次")
|
||||
return_date = fields.Date(string="日期")
|
||||
return_id = fields.Many2one('planning.slot', string="对方班次")
|
||||
return_two_date = fields.Date(string="日期")
|
||||
return_two_id = fields.Many2one('planning.slot', string="对方班次2")
|
||||
return_two_id = fields.Many2one('planning.slot', string="对方班次")
|
||||
department_id = fields.Many2one('hr.department', string="部门", related='resource_id.employee_id.department_id')
|
||||
resource_ids = fields.Many2many('resource.resource', string="资源用户列表")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</group>
|
||||
<group col="4" string="班次1">
|
||||
<group>
|
||||
<field name="shift_date"/>
|
||||
<field name="shift_date" invisible="alternate_shifts == 'alternate'"/>
|
||||
<field name="return_date"/>
|
||||
</group>
|
||||
<group>
|
||||
@@ -75,11 +75,12 @@
|
||||
('start_datetime', '>', shift_date + ' 00:00:00'),
|
||||
('end_datetime', '<', shift_date + ' 23:59:59')
|
||||
]"
|
||||
invisible="alternate_shifts == 'alternate'"
|
||||
context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
|
||||
'order': 'start_datetime desc',
|
||||
'search_default_group_by_month': True,}"/>
|
||||
<field name="return_id" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
<field name="return_id" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
|
||||
'order': 'start_datetime desc',
|
||||
'search_default_group_by_month': True,}"
|
||||
@@ -89,12 +90,11 @@
|
||||
('end_datetime', '<', return_date + ' 23:59:59')
|
||||
]"
|
||||
/>
|
||||
|
||||
</group>
|
||||
<group/>
|
||||
<group/>
|
||||
</group>
|
||||
<group string="班次2" col="4">
|
||||
<group string="班次2" col="4" invisible="alternate_shifts == 'alternate'">
|
||||
<group>
|
||||
<field name="shift_two_date"/>
|
||||
<field name="return_two_date"/>
|
||||
@@ -106,11 +106,11 @@
|
||||
('start_datetime', '>', shift_two_date + ' 00:00:00'),
|
||||
('end_datetime', '<', shift_two_date + ' 23:59:59')
|
||||
]"
|
||||
invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
|
||||
'order': 'start_datetime desc',
|
||||
'search_default_group_by_month': True,}"/>
|
||||
<field name="return_two_id" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
<field name="return_two_id" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
|
||||
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
|
||||
'order': 'start_datetime desc',
|
||||
'search_default_group_by_month': True,}"
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
'wizard/initialize_wizard_views.xml',
|
||||
'wizard/property_water_wizard_views.xml',
|
||||
'wizard/receivable_log_wizard_views.xml',
|
||||
'wizard/task_push_wizard_views.xml',
|
||||
'wizard/water_price_wizard.xml',
|
||||
'wizard/electric_water_wizard_views.xml',
|
||||
'wizard/meter_price_wizard.xml',
|
||||
|
||||
@@ -66,24 +66,6 @@ class PropertyMeterArchives(models.Model):
|
||||
)
|
||||
return record
|
||||
|
||||
def update_epitope_values(self):
|
||||
for record in self:
|
||||
for property in record.yuthon_property_ids:
|
||||
existing_energy = self.env["yuthon.property.energy"].search(
|
||||
[
|
||||
("yuthon_property_id", "=", property.id),
|
||||
("property_meter_archives_id", "=", record.id),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
if not existing_energy:
|
||||
self.env["yuthon.property.energy"].create(
|
||||
{
|
||||
"property_meter_archives_id": record.id,
|
||||
"yuthon_property_id": property.id,
|
||||
}
|
||||
)
|
||||
|
||||
@api.onchange("name")
|
||||
def _onchange_line_ids(self):
|
||||
if self.line_ids:
|
||||
@@ -98,27 +80,56 @@ class PropertyMeterArchives(models.Model):
|
||||
else:
|
||||
record.lessee_id = False
|
||||
|
||||
@api.onchange("yuthon_property_ids")
|
||||
def _onchange_property_ids(self):
|
||||
@api.constrains("yuthon_property_ids", "epitope_values_id")
|
||||
def _constrains_property_energy(self):
|
||||
for record in self:
|
||||
selected_properties = record.yuthon_property_ids
|
||||
meters_to_remove = self.env['yuthon.property.energy'].search([
|
||||
('property_meter_archives_id', '=', record.id),
|
||||
('yuthon_property_id', 'not in', selected_properties.ids)
|
||||
])
|
||||
if meters_to_remove:
|
||||
meters_to_remove.unlink()
|
||||
# 1. 当没有选中物业时,删除所有关联的明细行
|
||||
if not selected_properties:
|
||||
meters_to_remove = self.env['yuthon.property.energy'].search([
|
||||
('property_meter_archives_id', '=', record.id),
|
||||
])
|
||||
if meters_to_remove:
|
||||
related_properties = meters_to_remove.mapped('yuthon_property_id')
|
||||
meters_to_remove.unlink()
|
||||
# 更新物业的电表标记
|
||||
for prop in related_properties:
|
||||
prop.is_electricity_meter = bool(prop.energy_meter_ids)
|
||||
|
||||
for property in selected_properties:
|
||||
# 删除不在选中列表中的物业对应的明细行
|
||||
all_meters = self.env['yuthon.property.energy'].search([
|
||||
('property_meter_archives_id', '=', record.id),
|
||||
])
|
||||
meters_to_remove = all_meters.filtered(
|
||||
lambda m: m.yuthon_property_id not in selected_properties
|
||||
)
|
||||
if meters_to_remove:
|
||||
related_properties = meters_to_remove.mapped('yuthon_property_id')
|
||||
meters_to_remove.unlink()
|
||||
for prop in related_properties:
|
||||
prop.is_electricity_meter = bool(prop.energy_meter_ids)
|
||||
|
||||
# 为新增的选中物业创建明细行
|
||||
for prop in selected_properties:
|
||||
existing_meter = self.env['yuthon.property.energy'].search([
|
||||
('property_meter_archives_id', '=', record.id),
|
||||
('yuthon_property_id', '=', property.id)
|
||||
('yuthon_property_id', '=', prop.id)
|
||||
], limit=1)
|
||||
if not existing_meter:
|
||||
self.env['yuthon.property.energy'].create({
|
||||
'property_meter_archives_id': record.id,
|
||||
'yuthon_property_id': property.id,
|
||||
'yuthon_property_id': prop.id,
|
||||
})
|
||||
# 更新物业的电表标记
|
||||
prop.is_electricity_meter = bool(prop.energy_meter_ids)
|
||||
|
||||
if record.line_ids:
|
||||
write_vals = {
|
||||
'epitope_values_id': record.epitope_values_id.id,
|
||||
'yuthon_property_ids': [(6, 0, record.yuthon_property_ids.ids)]
|
||||
if record.yuthon_property_ids else [(5,)]
|
||||
}
|
||||
record.line_ids.write(write_vals)
|
||||
|
||||
def open_record(self):
|
||||
return {
|
||||
@@ -154,17 +165,6 @@ class PropertyMeterArchives(models.Model):
|
||||
for record in reading_ids:
|
||||
record.onchange_property()
|
||||
|
||||
@api.onchange("yuthon_property_ids", 'epitope_values_id')
|
||||
def onchange_property(self):
|
||||
for record in self:
|
||||
if not record.line_ids:
|
||||
return
|
||||
record.line_ids.write({
|
||||
'yuthon_property_ids': [(6, 0, record.yuthon_property_ids.ids)] if record.yuthon_property_ids else [],
|
||||
'epitope_values_id': record.epitope_values_id.id
|
||||
})
|
||||
record.update_epitope_values()
|
||||
|
||||
def action_property_meter_wizard(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -277,6 +277,7 @@ class MeterArchivesLine(models.Model):
|
||||
default="unreading",
|
||||
)
|
||||
maximum_count = fields.Integer(string="最大位数")
|
||||
is_push = fields.Boolean(string='推送', default=False)
|
||||
|
||||
@api.depends('last_read', 'current_read')
|
||||
def _compute_current_meter(self):
|
||||
@@ -383,3 +384,22 @@ class MeterArchivesLine(models.Model):
|
||||
)
|
||||
for record in meter_ids:
|
||||
record.onchange_lessee_id()
|
||||
|
||||
def push_task_push_wizard(self):
|
||||
meter_ids = self.env["meter.archives.line"].browse(
|
||||
self._context.get("active_ids", self._context.get("active_id"))
|
||||
)
|
||||
for meter_id in meter_ids:
|
||||
if meter_id.is_push == True:
|
||||
raise ValidationError(f"电表名为{meter_id.archives_id}任务已推送,请勿重复推送")
|
||||
return {
|
||||
"name": "电水表任务",
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "task.push.wizard",
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
"context": {
|
||||
"default_meter_ids": meter_ids.ids,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,24 +67,6 @@ class PropertyMeterWater(models.Model):
|
||||
)
|
||||
return record
|
||||
|
||||
def update_epitope_values(self):
|
||||
for record in self:
|
||||
for property in record.yuthon_property_ids:
|
||||
existing_energy = self.env["yuthon.property.water"].search(
|
||||
[
|
||||
("yuthon_property_id", "=", property.id),
|
||||
("property_meter_water_id", "=", record.id),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
if not existing_energy:
|
||||
self.env["yuthon.property.water"].create(
|
||||
{
|
||||
"property_meter_water_id": record.id,
|
||||
"yuthon_property_id": property.id,
|
||||
}
|
||||
)
|
||||
|
||||
def open_record(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -108,17 +90,6 @@ class PropertyMeterWater(models.Model):
|
||||
for record in water_ids:
|
||||
record.water_state = "stop"
|
||||
|
||||
@api.onchange("yuthon_property_ids", 'epitope_values_id')
|
||||
def onchange_property(self):
|
||||
for record in self:
|
||||
if not record.line_ids:
|
||||
return
|
||||
record.line_ids.write({
|
||||
'yuthon_property_ids': [(6, 0, record.yuthon_property_ids.ids)] if record.yuthon_property_ids else [],
|
||||
'epitope_values_id': record.epitope_values_id.id
|
||||
})
|
||||
record.update_epitope_values()
|
||||
|
||||
def action_property_water_wizard(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -140,26 +111,57 @@ class PropertyMeterWater(models.Model):
|
||||
"context": {"default_water_ids": [(6, 0, active_ids)]},
|
||||
}
|
||||
|
||||
@api.onchange("yuthon_property_ids")
|
||||
def _onchange_property_ids(self):
|
||||
@api.constrains("yuthon_property_ids", "epitope_values_id")
|
||||
def _constrains_property_water(self):
|
||||
for record in self:
|
||||
selected_properties = record.yuthon_property_ids
|
||||
meters_to_remove = self.env['yuthon.property.water'].search([
|
||||
# 当没有选中物业时,删除所有关联的水表示细行并更新物业标记
|
||||
if not selected_properties:
|
||||
meters_to_remove = self.env['yuthon.property.water'].search([
|
||||
('property_meter_water_id', '=', record.id),
|
||||
])
|
||||
if meters_to_remove:
|
||||
related_properties = meters_to_remove.mapped('yuthon_property_id')
|
||||
meters_to_remove.unlink()
|
||||
# 更新物业的水表标记(检查是否还有其他水表关联)
|
||||
for prop in related_properties:
|
||||
prop.is_meter = bool(prop.water_meter_ids)
|
||||
|
||||
# 删除不在选中列表中的物业对应的明细行
|
||||
all_meters = self.env['yuthon.property.water'].search([
|
||||
('property_meter_water_id', '=', record.id),
|
||||
('yuthon_property_id', 'not in', selected_properties.ids)
|
||||
])
|
||||
# 筛选出已移除的物业对应的明细行
|
||||
meters_to_remove = all_meters.filtered(
|
||||
lambda m: m.yuthon_property_id not in selected_properties
|
||||
)
|
||||
if meters_to_remove:
|
||||
related_properties = meters_to_remove.mapped('yuthon_property_id')
|
||||
meters_to_remove.unlink()
|
||||
for property in selected_properties:
|
||||
# 更新物业的水表标记
|
||||
for prop in related_properties:
|
||||
prop.is_meter = bool(prop.water_meter_ids)
|
||||
|
||||
for prop in selected_properties:
|
||||
existing_meter = self.env['yuthon.property.water'].search([
|
||||
('property_meter_water_id', '=', record.id),
|
||||
('yuthon_property_id', '=', property.id)
|
||||
('yuthon_property_id', '=', prop.id)
|
||||
], limit=1)
|
||||
if not existing_meter:
|
||||
self.env['yuthon.property.watery'].create({
|
||||
self.env['yuthon.property.water'].create({
|
||||
'property_meter_water_id': record.id,
|
||||
'yuthon_property_id': property.id,
|
||||
'yuthon_property_id': prop.id,
|
||||
})
|
||||
prop.is_meter = bool(prop.water_meter_ids)
|
||||
|
||||
# 4同步更新关联的line_ids记录
|
||||
if record.line_ids:
|
||||
write_vals = {
|
||||
'epitope_values_id': record.epitope_values_id.id,
|
||||
'yuthon_property_ids': [(6, 0, selected_properties.ids)]
|
||||
if selected_properties else [(5,)]
|
||||
}
|
||||
record.line_ids.write(write_vals)
|
||||
|
||||
def update_property(self):
|
||||
reading_ids = self.env["property.meter.water"].browse(
|
||||
@@ -214,6 +216,7 @@ class MeterWaterLine(models.Model):
|
||||
remarks = fields.Text(string='备注')
|
||||
employee_ids = fields.Many2many('hr.employee', string='抄表人')
|
||||
maximum_count = fields.Integer(string='最大位数')
|
||||
is_push = fields.Boolean(string='推送', default=False)
|
||||
|
||||
@api.depends('last_read', 'current_read')
|
||||
def _compute_current_meter(self):
|
||||
@@ -315,3 +318,21 @@ class MeterWaterLine(models.Model):
|
||||
)
|
||||
for record in meter_ids:
|
||||
record.onchange_lessee_id()
|
||||
|
||||
def push_task_push_wizard(self):
|
||||
water_ids = self.env["meter.water.line"].browse(
|
||||
self._context.get("active_ids", self._context.get("active_id"))
|
||||
)
|
||||
for water_id in water_ids:
|
||||
if water_id.is_push == True:
|
||||
raise ValidationError(f"水表名为{water_id.archives_id}任务已推送,请勿重复推送")
|
||||
return {
|
||||
"name": "电水表任务",
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "task.push.wizard",
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
"context": {
|
||||
"default_water_ids": water_ids.ids,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +99,5 @@ access_initialize_wizard,initialize.wizard,model_initialize_wizard,base.group_us
|
||||
access_receivable_modify_line, receivable.modify.line,model_receivable_modify_line,base.group_user,1,1,1,1
|
||||
access_meter_archives_line, meter.archives.line,model_meter_archives_line,base.group_user,1,1,1,1
|
||||
access_meter_water_line, meter.water.line,model_meter_water_line,base.group_user,1,1,1,1
|
||||
access_yuthon_epitope_values, yuthon.epitope.values,model_yuthon_epitope_values,base.group_user,1,1,1,1
|
||||
access_yuthon_epitope_values, yuthon.epitope.values,model_yuthon_epitope_values,base.group_user,1,1,1,1
|
||||
access_task_push_wizard,task.push.wizard,model_task_push_wizard,base.group_user,1,1,1,1
|
||||
|
@@ -87,11 +87,13 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="电表任务" create="False" editable="bottom" limit="15"
|
||||
js_class="custom_meter_button" decoration-success="not current_read" default_order="meter_date_month desc">
|
||||
<header>
|
||||
<button name="push_task_push_wizard" type="object" string="推送" dclass="oe_highlight"/>
|
||||
</header>
|
||||
<field name="archives_id" string="电表名"/>
|
||||
<field name="sequence" column_invisible="1"/>
|
||||
<field name="number" column_invisible="1"/>
|
||||
<field name="meter_date" readonly="1"/>
|
||||
<field name="archives_id" string="电表名"/>
|
||||
<field name="unit_number"/>
|
||||
<field name="gauge_magnification"/>
|
||||
<field name="initial_value" column_invisible="1"/>
|
||||
@@ -110,6 +112,7 @@
|
||||
<field name="archives_state" column_invisible="1"/>
|
||||
<field name="employee_ids" widget="many2many_tags" options="{'no_create': True}" readonly="1" column_invisible="1"/>
|
||||
<field name="line_loss"/>
|
||||
<field name="is_push"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -95,6 +95,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="水表任务" create="0" editable="bottom" js_class="custom_water_button" decoration-success="not current_read"
|
||||
default_order="meter_date_month desc" limit="15">
|
||||
<header>
|
||||
<button name="push_task_push_wizard" type="object" string="推送" dclass="oe_highlight"/>
|
||||
</header>
|
||||
<field name="sequence" column_invisible="1"/>
|
||||
<field name="meter_date" readonly="1"/>
|
||||
<field name="initial_value" column_invisible="1"/>
|
||||
@@ -114,6 +117,7 @@
|
||||
<field name="last_meter" readonly="1"/>
|
||||
<field name="last_dosage" readonly="1"/>
|
||||
<field name="line_loss"/>
|
||||
<field name="is_push"/>
|
||||
<field name="employee_ids" widget="many2many_tags" options="{'no_create': True, 'no_open': True}" readonly="1" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -9,3 +9,4 @@ from . import meter_price_wizard
|
||||
from . import water_price_wizard
|
||||
from . import initialize_wizard
|
||||
from . import electric_water_wizard
|
||||
from . import task_push_wizard
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api, _, SUPERUSER_ID
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
from pypinyin import pinyin, Style
|
||||
import xlrd
|
||||
import base64
|
||||
import datetime
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class TaskPushWizard(models.TransientModel):
|
||||
_name = 'task.push.wizard'
|
||||
_description = '电水表任务推送弹窗'
|
||||
|
||||
push_date = fields.Date(string='日期', default=fields.date.today())
|
||||
meter_ids = fields.Many2many('meter.archives.line', string='电表任务')
|
||||
water_ids = fields.Many2many('meter.water.line', string='水表任务')
|
||||
|
||||
def confirm(self):
|
||||
if self.meter_ids:
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '电费')], limit=1)
|
||||
for meter in self.meter_ids:
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': meter.contract_id.id,
|
||||
'lessee_id': meter.lessee_id.id if meter.lessee_id else None,
|
||||
'original_amount': meter.receivables,
|
||||
'due_date': self.push_date,
|
||||
'create_time': datetime.now(),
|
||||
'management_type_id': management_type_id.id,
|
||||
})
|
||||
meter.is_push = True
|
||||
if self.water_ids:
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '水费')], limit=1)
|
||||
for water in self.water_ids:
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': water.contract_id.id,
|
||||
'lessee_id': water.lessee_id.id if water.lessee_id else None,
|
||||
'original_amount': water.receivables,
|
||||
'due_date': self.push_date,
|
||||
'create_time': datetime.now(),
|
||||
'management_type_id': management_type_id.id,
|
||||
})
|
||||
water.is_push = True
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="task_push_wizard_form" model="ir.ui.view">
|
||||
<field name="name">task.push.wizard.form</field>
|
||||
<field name="model">task.push.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="电水表任务">
|
||||
<group>
|
||||
<field name="push_date" required="1"/>
|
||||
<field name="water_ids" invisible="1"/>
|
||||
<field name="meter_ids" invisible="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="confirm" type="object" string="确认" class="oe_highlight"/>
|
||||
<button special="cancel" string="取消" class="oe_link"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -14,22 +14,27 @@ class PropertyTenantInformation(models.Model):
|
||||
tenant_ids = self.env["property.tenant.information"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in tenant_ids:
|
||||
record.property_contract_ids.write({'property_contract_ids': [(5, 0, 0)]})
|
||||
property_contract_list = []
|
||||
contract_ids = self.env["property.lease.contract"].search([('lessee_id', '=', record.id)])
|
||||
for contract_id in contract_ids:
|
||||
property_ids = []
|
||||
if contract_id.lease_ids:
|
||||
for lease_id in contract_id.lease_ids:
|
||||
if lease_id.address_id:
|
||||
address_id = lease_id.address_id.id
|
||||
else:
|
||||
continue
|
||||
property_ids.append(address_id)
|
||||
property_contract_list.append([0, 0,{
|
||||
'tenant_id': record.id,
|
||||
'lease_contract_id': contract_id.id,
|
||||
'property_ids': [(6, 0, property_ids)],
|
||||
'rent': contract_id.rent,
|
||||
}])
|
||||
record.write({'property_contract_ids': property_contract_list})
|
||||
if record.property_contract_ids:
|
||||
for contract in record.property_contract_ids:
|
||||
if not contract.lease_contract_id:
|
||||
contract.unlink()
|
||||
|
||||
# record.property_contract_ids.write({'property_contract_ids': [(5, 0, 0)]})
|
||||
# property_contract_list = []
|
||||
# contract_ids = self.env["property.lease.contract"].search([('lessee_id', '=', record.id)])
|
||||
# for contract_id in contract_ids:
|
||||
# property_ids = []
|
||||
# if contract_id.lease_ids:
|
||||
# for lease_id in contract_id.lease_ids:
|
||||
# if lease_id.address_id:
|
||||
# address_id = lease_id.address_id.id
|
||||
# else:
|
||||
# continue
|
||||
# property_ids.append(address_id)
|
||||
# property_contract_list.append([0, 0,{
|
||||
# 'tenant_id': record.id,
|
||||
# 'lease_contract_id': contract_id.id,
|
||||
# 'property_ids': [(6, 0, property_ids)],
|
||||
# 'rent': contract_id.rent,
|
||||
# }])
|
||||
# record.write({'property_contract_ids': property_contract_list})
|
||||
|
||||
@@ -810,8 +810,8 @@ class PropertyAccountsReceivable(models.Model):
|
||||
# 批量退回
|
||||
def action_refuse_all(self):
|
||||
model_type_data = {
|
||||
'水费': 'property.water.list',
|
||||
'电费': 'property.tariff.list',
|
||||
'水费': 'meter.archives.line',
|
||||
'电费': 'meter.water.line',
|
||||
'押金': 'property.deposit.list',
|
||||
'租金': 'property.rent.list'
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class PropertyTenantLine(models.Model):
|
||||
_description = '物业承租方合同明细行'
|
||||
|
||||
tenant_id = fields.Many2one('property.tenant.information', string="关联租户信息")
|
||||
property_ids = fields.Many2many('yuthon.property', string="物业信息")
|
||||
property_name = fields.Char(related='lease_contract_id.property_name', string="物业信息")
|
||||
lease_contract_id = fields.Many2one('property.lease.contract', string="合同编号")
|
||||
rent = fields.Float(related='lease_contract_id.rent', string="租金")
|
||||
start_time = fields.Date(related='lease_contract_id.actual_start_time', string="生效日期")
|
||||
@@ -523,6 +523,22 @@ class PropertyLeaseContract(models.Model):
|
||||
'property_contract_ids': [(0, 0, contract_data)]
|
||||
})
|
||||
|
||||
# 更新承租方合同信息
|
||||
lessee_contract = self.env['property.tenant.line'].search([
|
||||
('tenant_id', '=', contract.lessee_id.id),
|
||||
('lease_contract_id', '=', contract.id)
|
||||
], limit=1)
|
||||
|
||||
lessee_date = {
|
||||
'tenant_id': contract.lessee_id.id,
|
||||
'lease_contract_id': contract.id,
|
||||
}
|
||||
|
||||
if not lessee_contract:
|
||||
lessee_contract.write({
|
||||
'property_contract_ids': [(0, 0, lessee_date)]
|
||||
})
|
||||
|
||||
contract_lines = self.env['property.contract.line'].search([
|
||||
('lease_contract_id', '=', contract.id)
|
||||
])
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<tree editable="bottom">
|
||||
<field name="tenant_id" column_invisible="1"/>
|
||||
<field name="lease_contract_id" options="{'no_create': True}"/>
|
||||
<field name="property_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||
<field name="property_name"/>
|
||||
<field name="rent"/>
|
||||
<field name="start_time"/>
|
||||
<field name="end_date"/>
|
||||
|
||||
@@ -30,6 +30,23 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="inherit_meter_archives_line_search" model="ir.ui.view">
|
||||
<field name="name">inherit.meter.archives.line.search</field>
|
||||
<field name="model">meter.archives.line</field>
|
||||
<field name="inherit_id" ref="yuthon_property.meter_archives_line_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='archives_id']" position="before">
|
||||
<field name="archives_id"
|
||||
string="综合搜索"
|
||||
filter_domain="['|', '|', '|', '|',
|
||||
('archives_id.name', 'ilike', self),
|
||||
('unit_number', 'ilike', self),
|
||||
('lessee_id.name', 'ilike', self),
|
||||
('contract_id.name', 'ilike', self)
|
||||
]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_meter_water_line_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">view.meter.water.line.tree.inherit</field>
|
||||
<field name="model">meter.water.line</field>
|
||||
@@ -40,6 +57,23 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="inherit_property_meter_water_search" model="ir.ui.view">
|
||||
<field name="name">inherit.property.meter.water.search</field>
|
||||
<field name="model">meter.water.line</field>
|
||||
<field name="inherit_id" ref="yuthon_property.meter_water_line_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='water_id']" position="before">
|
||||
<field name="water_id"
|
||||
string="综合搜索"
|
||||
filter_domain="['|', '|', '|',
|
||||
('water_id.name', 'ilike', self),
|
||||
('unit_number', 'ilike', self),
|
||||
('lessee_id.name', 'ilike', self),
|
||||
('contract_id.name', 'ilike', self)
|
||||
]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="yuthon_property_form_inherit" model="ir.ui.view">
|
||||
<field name="name">yuthon.property.form.inherit</field>
|
||||
<field name="model">yuthon.property</field>
|
||||
@@ -377,7 +411,7 @@
|
||||
<search>
|
||||
<field name="property_ids"
|
||||
string="综合搜索"
|
||||
filter_domain="['|', '|', ('property_ids.name', 'ilike', self), ('lessee_id.name', 'ilike', self), ('contract_id.contract_code', 'ilike', self), ('company_id.name', 'ilike', self)]"/>
|
||||
filter_domain="['|', '|', '|', ('property_ids.name', 'ilike', self), ('lessee_id.name', 'ilike', self), ('contract_id.contract_code', 'ilike', self), ('company_id.name', 'ilike', self)]"/>
|
||||
<field name="property_ids"/>
|
||||
<field name="lessee_id"/>
|
||||
<field name="contract_id" string="合同"/>
|
||||
@@ -412,13 +446,13 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.initialize_reconciliation()</field>
|
||||
</record>
|
||||
<record id="initialize_update_property" model="ir.actions.server">
|
||||
<field name="name">更新物业信息</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_accounts_receivable"/>
|
||||
<field name="binding_model_id" ref="yuthon_property.model_property_accounts_receivable"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_property_ids()</field>
|
||||
</record>
|
||||
<!-- <record id="initialize_update_property" model="ir.actions.server">-->
|
||||
<!-- <field name="name">更新物业信息</field>-->
|
||||
<!-- <field name="model_id" ref="yuthon_property.model_property_accounts_receivable"/>-->
|
||||
<!-- <field name="binding_model_id" ref="yuthon_property.model_property_accounts_receivable"/>-->
|
||||
<!-- <field name="state">code</field>-->
|
||||
<!-- <field name="code">action = model.update_property_ids()</field>-->
|
||||
<!-- </record>-->
|
||||
<record id="de_duplicate_server" model="ir.actions.server">
|
||||
<field name="name">删除重复数据</field>
|
||||
<field name="model_id" ref="yuthon_property.model_property_accounts_receivable"/>
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="number" invisible="1"/>
|
||||
<field name="is_issues"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_issues"/>
|
||||
|
||||
@@ -252,16 +252,16 @@
|
||||
name="管理费列表"
|
||||
parent="yuthon_property.yuthon_property_fee_management"
|
||||
action="property_management_list_action"/>
|
||||
<menuitem id="yuthon_property_tariff_list"
|
||||
sequence="32"
|
||||
name="电费列表"
|
||||
parent="yuthon_property.yuthon_property_fee_management"
|
||||
action="view_property_tariff_list_action"/>
|
||||
<menuitem id="yuthon_property_water_list"
|
||||
sequence="40"
|
||||
name="水费列表"
|
||||
parent="yuthon_property.yuthon_property_fee_management"
|
||||
action="view_property_water_list_action"/>
|
||||
<!-- <menuitem id="yuthon_property_tariff_list"-->
|
||||
<!-- sequence="32"-->
|
||||
<!-- name="电费列表"-->
|
||||
<!-- parent="yuthon_property.yuthon_property_fee_management"-->
|
||||
<!-- action="view_property_tariff_list_action"/>-->
|
||||
<!-- <menuitem id="yuthon_property_water_list"-->
|
||||
<!-- sequence="40"-->
|
||||
<!-- name="水费列表"-->
|
||||
<!-- parent="yuthon_property.yuthon_property_fee_management"-->
|
||||
<!-- action="view_property_water_list_action"/>-->
|
||||
<menuitem id="yuthon_property_deposit_list"
|
||||
sequence="45"
|
||||
name="押金列表"
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="lease_contract_id" invisible="1"/>
|
||||
<field name="contract_sort_name"/>
|
||||
<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="contract_sort_name" 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), ('asset_type_id.name', '=', contract_sort_name)]"/>
|
||||
<field name="property_ids2" widget="many2many_tags" invisible="1"/>
|
||||
</group>
|
||||
<group/>
|
||||
|
||||
@@ -20,15 +20,17 @@ class ChoosePropertyWizard(models.Model):
|
||||
contract_sort_name = fields.Char(
|
||||
string="合同类型名称",
|
||||
compute='_compute_contract_sort_name',
|
||||
store=False
|
||||
store=True
|
||||
)
|
||||
|
||||
@api.depends('lease_contract_id.contract_sort')
|
||||
def _compute_contract_sort_name(self):
|
||||
type_mapping = {
|
||||
'property': '物业',
|
||||
'ads': '广告位',
|
||||
'guan': '管子间'
|
||||
'guanggao': '广告位',
|
||||
'guanzi': '管子间',
|
||||
'room': '机房',
|
||||
'base_station': '基站'
|
||||
}
|
||||
for rec in self:
|
||||
if rec.lease_contract_id and rec.lease_contract_id.contract_sort:
|
||||
|
||||
Reference in New Issue
Block a user