Merge pull request !2289 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-04-02 08:00:38 +00:00
committed by Gitee
21 changed files with 230 additions and 99 deletions
@@ -36,13 +36,6 @@ class YuthonDutyPlan(models.Model):
next_month = (month % 12) + 1
next_year = year + (1 if next_month == 1 else 0) # 如果是12月,年份加1
last_day_of_month = datetime(next_year, next_month, 1)
existing_slots = self.env['planning.slot'].search([
('role_id.name', '=', '联安粮库'),
('start_datetime', '>=', first_day_of_month),
('start_datetime', '<=', last_day_of_month),
])
if len(existing_slots) > 0:
raise UserError(f"该月已经有排程,请选择其他时间。")
else:
next_month = (month % 12) + 1
next_year = year + (1 if next_month == 1 else 0)
@@ -50,13 +43,6 @@ class YuthonDutyPlan(models.Model):
next_next_month = (next_month % 12) + 1
next_next_year = next_year + (1 if next_next_month == 1 else 0)
last_day_of_month = datetime(next_next_year, next_next_month, 1)
existing_slots = self.env['planning.slot'].search([
('role_id.name', '=', '联安粮库'),
('start_datetime', '>=', first_day_of_month),
('start_datetime', '<=', last_day_of_month),
])
if len(existing_slots) > 0:
raise UserError(f"该月已经有排程,请选择其他时间。")
latest_slot = self.env['planning.slot'].search([('role_id.name', '=', '联安粮库')], order='start_datetime desc',limit=1)
if latest_slot:
latest_month = latest_slot.start_datetime.month
@@ -56,7 +56,8 @@ class YuthonHrEmployee(models.Model):
user_number_start_time = fields.Date(string="身份证开始时间")
user_number_end_time = fields.Date(string="身份证到期时间")
is_identification = fields.Boolean(string="是否填写身份证")
card_documents_id = fields.Many2one('ir.attachment', string="身份证")
card_documents_id = fields.Many2one('ir.attachment', string="身份证正面")
card_back_documents_id = fields.Many2one('ir.attachment', string="身份证反面")
hukou_documents_id = fields.Many2one('ir.attachment', string="户口本")
marriage_documents_id = fields.Many2one('ir.attachment', string="结婚证")
nation = fields.Selection(nation_list, string="民族")
@@ -107,6 +107,7 @@
<xpath expr="//field[@name='identification_id']" position="after">
<field name="is_identification" invisible="1"/>
<field name="card_documents_id" widget="preview_many2one" invisible="not is_identification"/>
<field name="card_back_documents_id" widget="preview_many2one" invisible="not is_identification"/>
</xpath>
<xpath expr="//group[@name='active_group']" position="after">
<group string="工作信息">
+2
View File
@@ -47,6 +47,7 @@
'views/property_check_room_views.xml',
'views/property_check_stairs_views.xml',
'views/property_check_decorate_views.xml',
'views/property_evaluation_plan_view.xml',
'views/property_other_list_views.xml',
'views/property_bank_statements_views.xml',
'views/property_water_reading_views.xml',
@@ -55,6 +56,7 @@
'views/property_accounts_receivable_views.xml',
'wizard/yuthon_property_wizard_views.xml',
'wizard/property_meter_wizard_views.xml',
'wizard/rental_scheme_wizard_views.xml',
'wizard/property_tenant_wizard_views.xml',
'wizard/property_water_wizard_views.xml',
'wizard/property_statements_wizard_views.xml',
+2 -1
View File
@@ -40,4 +40,5 @@ from . import property_deposit_list
from . import property_accounts_receivable
from . import property_construction_unit
from . import property_accounting_unit
from . import property_subject_form
from . import property_subject_form
from . import property_evaluation_plan
@@ -0,0 +1,52 @@
from odoo import models, fields, api
from odoo.exceptions import UserError, ValidationError
class PropertyEvaluationPlan(models.Model):
_name = 'property.evaluation.plan'
_description = '物业评估方案'
name = fields.Char(string='物业名称')
evaluation_area = fields.Float(string='评估面积(m²)')
assessment_category = fields.Selection([('rent_money', '租金'), ('value', '价值')], string="评估类别")
owner_id = fields.Many2one('yuthon.owner.message', string="权属人")
registered_id = fields.Many2one('yuthon.purpose.evidence', string='证载用途')
registered_id2 = fields.Many2one('yuthon.purpose.evidence', string='设定用途')
rent_id = fields.Many2one('rent.free.setting', string="办法")
start_lease_period = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 7)], string='租期开始',
default='1')
end_lease_period = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 7)], string='租期结束',
default='6')
annual_increase_percentage = fields.Float(string='每年递增(%)', igits=(6, 2))
is_pust = fields.Boolean(string='是否已提交')
remake = fields.Text(string='备注')
def put_assessment_approval(self):
property_evaluation_ids = self.env["property.evaluation.plan"].browse(
self._context.get('active_ids', self._context.get('active_id')))
form_id = self.env.ref('yuthon_property_approval.property_evaluate_application_form').id
property_list = []
for i in property_evaluation_ids:
property_list.append([0, 0, {
'property_evaluation_id': i.id,
}])
return {
'name': '提交物业评估',
'view_mode': 'form',
'res_model': 'property.evaluate.application',
'type': 'ir.actions.act_window',
'views': [(form_id, 'form')],
"context": {
'default_property_ids': property_list,
'default_is_property': True,
}
}
def rental_scheme_wizard(self):
return {
'name': '整租方案弹窗',
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'rental.scheme.wizard',
'target': 'new',
}
+2 -26
View File
@@ -208,32 +208,8 @@ class YuthonProperty(models.Model):
}
def put_assessment_approval(self):
property_ids = self.env["yuthon.property"].browse(
self._context.get('active_ids', self._context.get('active_id')))
if not property_ids:
if self.state != 'to':
raise UserError("当前状态不允许提交")
else:
for i in property_ids:
if i.state != 'to':
raise UserError("当前状态不允许提交")
form_id = self.env.ref('yuthon_property_approval.property_evaluate_application_form').id
property_list = []
for i in property_ids:
property_list.append([0, 0, {
'property_id': i.id,
}])
return {
'name': '提交物业评估',
'view_mode': 'form',
'res_model': 'property.evaluate.application',
'type': 'ir.actions.act_window',
'views': [(form_id, 'form')],
"context": {
'default_property_ids': property_list,
'default_is_property' : True,
}
}
for record in self:
pass
# 拆分
def put_split_approval(self):
@@ -231,4 +231,11 @@ class PropertyFloorSetting(models.Model):
_description = '楼层配置'
name = fields.Char(string="名称")
premises_ids = fields.Many2many('yuthon.premises.setting', string="所属楼盘")
premises_ids = fields.Many2many('yuthon.premises.setting', string="所属楼盘")
class EvaluationCompany(models.Model):
_name = 'evaluation.company'
_description = '评估公司配置'
name = fields.Char(string="名称")
+4 -1
View File
@@ -83,4 +83,7 @@ access_rent_free_line,rent_free_line,model_rent_free_line,base.group_user,1,1,1,
access_feature_setting,feature_setting,model_feature_setting,base.group_user,1,1,1,1
access_major_event_setting,major_event_setting,model_major_event_setting,base.group_user,1,1,1,1
access_yuthon_major_event_line,yuthon_major_event_line,model_yuthon_major_event_line,base.group_user,1,1,1,1
access_property_floor_setting,property_floor_setting,model_property_floor_setting,base.group_user,1,1,1,1
access_property_floor_setting,property_floor_setting,model_property_floor_setting,base.group_user,1,1,1,1
access_property_evaluation_plan,property_evaluation_plan,model_property_evaluation_plan,base.group_user,1,1,1,1
access_rental_scheme_wizard,rental_scheme_wizard,model_rental_scheme_wizard,base.group_user,1,1,1,1
access_evaluation_company,evaluation_company,model_evaluation_company,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
83 access_feature_setting feature_setting model_feature_setting base.group_user 1 1 1 1
84 access_major_event_setting major_event_setting model_major_event_setting base.group_user 1 1 1 1
85 access_yuthon_major_event_line yuthon_major_event_line model_yuthon_major_event_line base.group_user 1 1 1 1
86 access_property_floor_setting property_floor_setting model_property_floor_setting base.group_user 1 1 1 1
87 access_property_evaluation_plan property_evaluation_plan model_property_evaluation_plan base.group_user 1 1 1 1
88 access_rental_scheme_wizard rental_scheme_wizard model_rental_scheme_wizard base.group_user 1 1 1 1
89 access_evaluation_company evaluation_company model_evaluation_company base.group_user 1 1 1 1
+9 -1
View File
@@ -263,13 +263,15 @@
parent="resource_management_menu"
name="配置"
action="yuthon_resource_mgmt_config_action"
sequence="50"/>
sequence="99"/>
<menuitem id="yuthon_property_message_menu" parent="resource_mgmt_config_menu" name="产权管理"
action="view_yuthon_property_message_action" sequence="1"/>
<menuitem id="yuthon_precinct_message_menu" parent="resource_mgmt_config_menu" name="片区管理"
action="view_yuthon_precinct_message_action" sequence="5"/>
<menuitem id="evaluation_company_menu" parent="resource_mgmt_config_menu" name="评估公司"
action="action_evaluation_company" sequence="7"/>
<menuitem id="yuthon_resource_type_menu" parent="resource_mgmt_config_menu" name="出租类型"
action="yuthon_resource_type_action" sequence="10"/>
<menuitem id="yuthon_owner_message_menu" parent="resource_mgmt_config_menu" name="权属人配置"
@@ -330,6 +332,12 @@
name="物业信息"
sequence="3"
action="yuthon_property_action"/>
<menuitem
id="property_evaluation_plan_menu"
name="物业评估方案"
parent="resource_management_menu"
action="view_property_evaluation_plan_action"
sequence="5"/>
<menuitem
id="property_approval_menu"
parent="yuthon_property_menu_root"
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_property_evaluation_plan_tree" model="ir.ui.view">
<field name="name">property.evaluation.plan.tree</field>
<field name="model">property.evaluation.plan</field>
<field name="arch" type="xml">
<tree string="物业评估方案" editable="bottom">
<header>
<button name="put_assessment_approval" type="object" string="提交评估申请" class="btn btn-primary"/>
<button name="rental_scheme_wizard" type="object" string="整租方案" class="btn btn-primary"/>
</header>
<field name="name"/>
<field name="evaluation_area"/>
<field name="assessment_category"/>
<field name="owner_id"/>
<field name="registered_id"/>
<field name="registered_id2"/>
<field name="start_lease_period"/>
<field name="end_lease_period"/>
<field name="rent_id"/>
<field name="annual_increase_percentage"/>
<field name="remake"/>
</tree>
</field>
</record>
<record id="view_property_evaluation_plan_search" model="ir.ui.view">
<field name="name">property.evaluation.plan.search</field>
<field name="model">property.evaluation.plan</field>
<field name="arch" type="xml">
<search string="物业评估方案">
<field name="name"/>
<field name="owner_id"/>
</search>
</field>
</record>
<record id="view_property_evaluation_plan_action" model="ir.actions.act_window">
<field name="name">物业评估方案</field>
<field name="res_model">property.evaluation.plan</field>
<field name="view_mode">tree,search</field>
</record>
</odoo>
@@ -6,7 +6,6 @@
<field name="arch" type="xml">
<tree string="物业管理">
<header>
<button name="put_assessment_approval" type="object" string="提交评估申请" class="btn btn-primary"/>
<button name="put_merge_approval" string="合并" type="object" class="btn btn-primary"/>
<button name="put_property_handover" string="物业移交" type="object" class="btn btn-primary"/>
<button name="put_declare_approval" type="object" string="提交出租申报" class="btn btn-primary"/>
@@ -17,6 +16,7 @@
<field name="rent_area" digits="[16, 4]"/>
<field name="equity_area" digits="[16, 4]"/>
<field name="state"/>
<button name="put_assessment_approval" type="object" string="推送" class="btn btn-primary"/>
<button name="put_split_approval" type="object" string="拆分" class="btn btn-primary" invisible="state != 'done'"/>
<button name="put_offline_approval" type="object" string="提交线下审批" class="btn btn-primary" invisible="state != 'done'"/>
<button name="put_adjustment_approval" type="object" string="调整出租条件" class="btn btn-primary" invisible="state != 'done'"/>
@@ -382,4 +382,18 @@
<field name="res_model">property.floor.setting</field>
<field name="view_mode">tree</field>
</record>
<record id="views_evaluation_company_tree" model="ir.ui.view">
<field name="name">evaluation.company.tree</field>
<field name="model">evaluation.company</field>
<field name="arch" type="xml">
<tree string="评估公司" editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="action_evaluation_company" model="ir.actions.act_window">
<field name="name">评估公司</field>
<field name="res_model">evaluation.company</field>
<field name="view_mode">tree</field>
</record>
</odoo>
+1
View File
@@ -3,3 +3,4 @@ from . import property_meter_wizard
from . import property_tenant_wizard
from . import property_water_wizard
from . import property_statements_wizard
from . import rental_scheme_wizard
@@ -0,0 +1,14 @@
from odoo import models, fields, api, _, SUPERUSER_ID
from odoo.exceptions import UserError, ValidationError
from dateutil.relativedelta import relativedelta
from datetime import datetime, time, timedelta
class RentalSchemeWizard(models.Model):
_name = 'rental.scheme.wizard'
_description = '整租方案弹窗'
name = fields.Char(string='方案名称')
def confirm(self):
pass
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="rental_scheme_wizard_form" model="ir.ui.view">
<field name="name">整租方案弹窗</field>
<field name="model">rental.scheme.wizard</field>
<field name="arch" type="xml">
<form string="整租方案弹窗">
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
<footer>
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
<button string="返回" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>
@@ -9,7 +9,6 @@ class PropertyEvaluateApplication(models.Model):
_description = '物业评估申请'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
name = fields.Char(string='标题', default='物业评估申请')
code = fields.Char(string='编号', required=True, copy=False,
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_property_code'))
@@ -28,6 +27,11 @@ class PropertyEvaluateApplication(models.Model):
active = fields.Boolean('Active', default=True, tracking=True)
is_premises = fields.Boolean(string="楼盘选择")
is_property = fields.Boolean(string='物业选择')
evaluation_company_id = fields.Many2one('evaluation.company', string='公司')
quote = fields.Float(string='报价')
service_money = fields.Float(string='评估服务费总额')
pay_time = fields.Date(string='支付时间')
pay_way = fields.Char(string='支付方式')
work_end = fields.Boolean(string="结束")
def _get_default_name_title(self):
@@ -114,22 +118,18 @@ class YuhtonPropertyLine(models.Model):
_description = '物业信息评估明细'
property_message_id = fields.Many2one('property.evaluate.application', string='关联评估申请')
property_id = fields.Many2one('yuthon.property', string="物业")
owner_id = fields.Many2one('yuthon.owner.message', string="权属人", compute='_compute_owner_id')
assessment_category = fields.Selection([('rent_money', '租金'), ('value', '价值')], string="评估类别")
registered_id = fields.Many2one('yuthon.purpose.evidence', string='证载用途', compute='_compute_registered_id')
registered_id2 = fields.Many2one('yuthon.purpose.evidence', string='设定用途')
purpose_id = fields.Many2one(related='property_id.purpose_id', string="管理类型")
rent_id = fields.Many2one('rent.free.setting', string="办法", compute='_compute_rent_id')
start_lease_period = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 7)], string='租期开始',
default='1', compute='_compute_start_lease_period')
end_lease_period = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 7)], string='租期结束',
default='6', compute='_compute_end_lease_period')
annual_increase_percentage = fields.Float(string='每年递增(%)', digits=(6, 2),
compute='_compute_annual_increase_percentage')
rental_conditions = fields.Text(related='property_id.rental_conditions', string='出租条件')
evaluation_area = fields.Float(string='评估面积(m²)')
remarks = fields.Text(string='备注')
property_evaluation_id = fields.Many2one('property.evaluation.plan', string="关联物业评估方案")
owner_id = fields.Many2one('yuthon.owner.message', related='property_evaluation_id.owner_id', string="权属人")
assessment_category = fields.Selection(related='property_evaluation_id.assessment_category', string="评估类别")
start_lease_period = fields.Selection(related='property_evaluation_id.start_lease_period', string='租期开始')
end_lease_period = fields.Selection(related='property_evaluation_id.end_lease_period', string='租期结束')
registered_id = fields.Many2one(related='property_evaluation_id.registered_id', string='证载用途')
registered_id2 = fields.Many2one(related='property_evaluation_id.registered_id2', string='设定用途')
annual_increase_percentage = fields.Float(related='property_evaluation_id.annual_increase_percentage', string='每年递增(%)', igits=(6, 2))
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
evaluation_area = fields.Float(related='property_evaluation_id.evaluation_area', string='评估面积(m²)')
rent_id = fields.Many2one('rent.free.setting', string="办法")
remarks = fields.Text(related='property_evaluation_id.remake', string='备注')
def set_property_state_to_ing(self):
domain = [('state', '=', 'to')]
@@ -140,32 +140,32 @@ class YuhtonPropertyLine(models.Model):
for property in property_ids:
property.write({'state': 'ing'})
@api.depends('property_id.title_information_ids')
def _compute_registered_id(self):
for record in self:
record.registered_id = record.property_id.title_information_ids[0].registered_id if record.property_id.title_information_ids else None
@api.depends('property_id.title_information_ids')
def _compute_owner_id(self):
for record in self:
record.owner_id = record.property_id.title_information_ids[0].owner_id if record.property_id.title_information_ids else None
@api.depends('property_id.reference_ids')
def _compute_rent_id(self):
for record in self:
record.rent_id = record.property_id.reference_ids[0].rent_id if record.property_id.reference_ids else None
@api.depends('property_id.reference_ids')
def _compute_start_lease_period(self):
for record in self:
record.start_lease_period = record.property_id.reference_ids[0].start_lease_period if record.property_id.reference_ids else None
@api.depends('property_id.reference_ids')
def _compute_end_lease_period(self):
for record in self:
record.end_lease_period = record.property_id.reference_ids[0].end_lease_period if record.property_id.reference_ids else None
@api.depends('property_id.reference_ids')
def _compute_annual_increase_percentage(self):
for record in self:
record.annual_increase_percentage = record.property_id.reference_ids[0].annual_increase_percentage if record.property_id.reference_ids else None
# @api.depends('property_id.title_information_ids')
# def _compute_registered_id(self):
# for record in self:
# record.registered_id = record.property_id.title_information_ids[0].registered_id if record.property_id.title_information_ids else None
#
# @api.depends('property_id.title_information_ids')
# def _compute_owner_id(self):
# for record in self:
# record.owner_id = record.property_id.title_information_ids[0].owner_id if record.property_id.title_information_ids else None
#
# @api.depends('property_id.reference_ids')
# def _compute_rent_id(self):
# for record in self:
# record.rent_id = record.property_id.reference_ids[0].rent_id if record.property_id.reference_ids else None
#
# @api.depends('property_id.reference_ids')
# def _compute_start_lease_period(self):
# for record in self:
# record.start_lease_period = record.property_id.reference_ids[0].start_lease_period if record.property_id.reference_ids else None
#
# @api.depends('property_id.reference_ids')
# def _compute_end_lease_period(self):
# for record in self:
# record.end_lease_period = record.property_id.reference_ids[0].end_lease_period if record.property_id.reference_ids else None
#
# @api.depends('property_id.reference_ids')
# def _compute_annual_increase_percentage(self):
# for record in self:
# record.annual_increase_percentage = record.property_id.reference_ids[0].annual_increase_percentage if record.property_id.reference_ids else None
@@ -94,6 +94,6 @@ access_property_service_approval,property_service_approval,model_property_servic
access_property_engineering_approval,property_engineering_approval,model_property_engineering_approval,base.group_user,1,1,1,1
access_property_current_approval, property_current_approval,model_property_current_approval,base.group_user,1,1,1,1
access_property_accounts_approval, property_accounts_approval,model_property_accounts_approval,base.group_user,1,1,1,1
access_yuthon_property_line, yuthon_property_line,model_yuthon_property_line,base.group_user,1,1,1,1
access_yuthon_property_line,yuthon_property_line,model_yuthon_property_line,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
94 access_property_current_approval property_current_approval model_property_current_approval base.group_user 1 1 1 1
95 access_property_accounts_approval property_accounts_approval model_property_accounts_approval base.group_user 1 1 1 1
96 access_yuthon_property_line yuthon_property_line model_yuthon_property_line base.group_user 1 1 1 1
97
98
99
@@ -49,6 +49,10 @@
<group>
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="quote"/>
<field name="service_money"/>
<field name="pay_time"/>
<field name="pay_way"/>
<field name="is_experts"/>
</group>
<group col="2">
@@ -85,7 +89,7 @@
<field name="property_ids" string=" ">
<tree editable="bottom">
<field name="property_message_id" column_invisible="1"/>
<field name="property_id" class="list_width"/>
<field name="property_evaluation_id" class="list_width"/>
<field name="evaluation_area"/>
<field name="assessment_category"/>
<field name="owner_id"/>
@@ -5,7 +5,7 @@
parent="yuthon_property.resource_management_menu"
name="新增物业审批"
action="property_approval_action"
sequence="3"/>
sequence="10"/>
<menuitem
id="property_billing_confirmation_menu"
@@ -126,19 +126,19 @@
parent="yuthon_property.resource_management_menu"
name="物业移交审批"
action="property_handover_action"
sequence="7"/>
sequence="20"/>
<menuitem
id="property_merge_approval_views_menu"
parent="yuthon_property.resource_management_menu"
name="物业合并审批"
action="property_merge_approval_action"
sequence="9"/>
sequence="30"/>
<menuitem
id="property_split_approval_views_menu"
parent="yuthon_property.resource_management_menu"
name="物业拆分审批"
action="property_split_approval_action"
sequence="11"/>
sequence="40"/>
<menuitem
id="property_open_rent_approval_menu"
parent="yuthon_property.property_approval_menu"
+1 -1
View File
@@ -10,7 +10,7 @@ class YuthonTaskApproval(models.Model):
_rec_name = 'name'
name = fields.Char(string='标题')
code = fields.Char(string="报修编号",
code = fields.Char(string="作业编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_report_repair_code'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")